Diff for /OSA_system2/OSAS_server.py between versions 1.7 and 1.11

version 1.7, 2005/02/12 11:41:56 version 1.11, 2005/03/03 20:41:00
Line 2  import os Line 2  import os
 import os.path  import os.path
 import stat  import stat
 import OSAS_helpers  import OSAS_helpers
   import xmlrpclib
 import bz2  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
   
   def encodeRPC(string):
       return base64.encodestring(bz2.compress(string))
   
   
 class OSAS_storeOnlineServer(SimpleItem):  class OSAS_storeOnlineServer(SimpleItem):
Line 80  class OSAS_storeOnlineServer(SimpleItem) Line 83  class OSAS_storeOnlineServer(SimpleItem)
         """getFile"""          """getFile"""
   
         if not os.path.exists(path):          if not os.path.exists(path):
               print "sorry"
             return None              return None
   
         f=file(path,'r')          f=file(path,'r')
Line 94  class OSAS_storeOnlineServer(SimpleItem) Line 98  class OSAS_storeOnlineServer(SimpleItem)
         """get all index Metas"""          """get all index Metas"""
         ret={}          ret={}
         if os.path.exists(path+"/index.meta"):          if os.path.exists(path+"/index.meta"):
             ret["."]=file(path+"/index.meta","r").read()              compressed=encodeRPC(file(path+"/index.meta","r").read())
               ret["."]=('OSAS_dir',compressed)
         for dir in os.listdir(path):          for dir in os.listdir(path):
             fileType=OSAS_helpers.checkOSASFileType(os.path.join(path,dir))              fileType=OSAS_helpers.checkOSASFileType(os.path.join(path,dir))
             if os.path.exists(os.path.join(path,dir,"index.meta")):              if os.path.exists(os.path.join(path,dir,"index.meta")):
                 ret[dir]=('OSAS_dir',file(os.path.join(path,dir,"index.meta"),"r").read())                  compressed=encodeRPC(file(os.path.join(path,dir,"index.meta"),"r").read())
                   ret[dir]=('OSAS_dir',compressed)
             else:              else:
                 ret[dir]=(fileType,None)                  ret[dir]=(fileType,None)
         return return bz2.compress(ret)          return ret
   
       def writeMetaDataFile(self,path,metadata):
           """writefiletoserver"""
           try:
               fh=file(path,"w")
               fh.write(metadata)
               fh.close
               return True
           except:
               return False
                                                               
                   
 def manage_addOSAS_storeOnlineServerForm(self):  def manage_addOSAS_storeOnlineServerForm(self):

Removed from v.1.7  
changed lines
  Added in v.1.11


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>