|
|
| version 1.3, 2005/02/11 12:03:31 | version 1.10, 2005/02/14 18:15:16 |
|---|---|
| Line 1 | Line 1 |
| import os | import os |
| import os.path | import os.path |
| import stat | import stat |
| import OSAS_helpers | |
| import xmlrpclib | |
| import bz2 | |
| import base64 | |
| from Products.PageTemplates.PageTemplateFile import PageTemplateFile | from Products.PageTemplates.PageTemplateFile import PageTemplateFile |
| from Globals import InitializeClass,package_home | from Globals import InitializeClass,package_home |
| from OFS.SimpleItem import SimpleItem | from OFS.SimpleItem import SimpleItem |
| import OSAS_helpers | def encodeRPC(string): |
| from OSAS_helpers import * | return base64.encodestring(bz2.compress(string)) |
| class OSAS_storeOnlineServer(SimpleItem): | class OSAS_storeOnlineServer(SimpleItem): |
| """Server for store Online system""" | """Server for store Online system""" |
| _v_metaFiles={} #chache fuer indexMeta | |
| meta_type="OSAS_server" | meta_type="OSAS_server" |
| Line 64 class OSAS_storeOnlineServer(SimpleItem) | Line 69 class OSAS_storeOnlineServer(SimpleItem) |
| """list dir""" | """list dir""" |
| return os.listdir(path) | return os.listdir(path) |
| def isdir(self,path=""): | |
| """list dir""" | |
| return os.path.isdir(path) | |
| def isfile(self,path=""): | |
| """list dir""" | |
| return os.path.isfile(path) | |
| def getFile(self,path): | def getFile(self,path): |
| """getFile""" | """getFile""" |
| if not os.path.exists(path): | |
| return None | |
| f=file(path,'r') | f=file(path,'r') |
| ret=f.read() | ret=f.read() |
| f.close() | f.close() |
| return ret | return ret |
| def getAllIndexMetasOfSubDirs(self,path): | |
| """get all index Metas""" | |
| ret={} | |
| if os.path.exists(path+"/index.meta"): | |
| compressed=encodeRPC(file(path+"/index.meta","r").read()) | |
| ret["."]=('OSAS_dir',compressed) | |
| for dir in os.listdir(path): | |
| fileType=OSAS_helpers.checkOSASFileType(os.path.join(path,dir)) | |
| if os.path.exists(os.path.join(path,dir,"index.meta")): | |
| compressed=encodeRPC(file(os.path.join(path,dir,"index.meta"),"r").read()) | |
| ret[dir]=('OSAS_dir',compressed) | |
| else: | |
| ret[dir]=(fileType,None) | |
| return ret | |
| def manage_addOSAS_storeOnlineServerForm(self): | def manage_addOSAS_storeOnlineServerForm(self): |
| """interface for adding the OSAS_storeOnline""" | """interface for adding the OSAS_storeOnline""" |
| pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','addStoreOnlineServer.zpt')).__of__(self) | pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','addStoreOnlineServer.zpt')).__of__(self) |