Diff for /OSA_system2/OSAS_server.py between versions 1.5 and 1.12

version 1.5, 2005/02/11 17:01:22 version 1.12, 2005/03/04 14:53:40
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
   
   def encodeRPC(string):
       return base64.encodestring(bz2.compress(string))
   
   
 class OSAS_storeOnlineServer(SimpleItem):  class OSAS_storeOnlineServer(SimpleItem):
Line 14  class OSAS_storeOnlineServer(SimpleItem) Line 19  class OSAS_storeOnlineServer(SimpleItem)
           
     meta_type="OSAS_server"      meta_type="OSAS_server"
   
       def getImages(path):
           """hack"""
           imageEnding=['.gif','.jpg','.jpeg','.png','.tiff','.tif']
           dirs=os.listdir(path)
           ret=[]
           for dir in dirs:
               if os.path.isdir(dir):
                   for subdir in os.listdir(os.path.join(path,dir)):
                       if os.path.splitext(subdir)[1].lower() in imageEnding:
                           ret.append(os.path.join(dir,subdir))
               else:
                   if os.path.splitext(dir)[1] in imageEnding:
                           ret.append(os.path.join(dir))
           return ret
       
   
       def getMovies(path):
           """hack"""
           movieEnding=['.dv','.mov','.mp4']
           dirs=os.listdir(path)
           ret=[]
           for dir in dirs:
               if os.path.isdir(dir):
                   for subdir in os.listdir(os.path.join(path,dir)):
                       if os.path.splitext(subdir)[1].lower() in movieEnding:
                           ret.append(os.path.join(dir,subdir))
               else:
                   if os.path.splitext(dir)[1] in imageEnding:
                           ret.append(os.path.join(dir))
           return ret
       
       
     def findIndexMeta(self,realPath=""):      def findIndexMeta(self,realPath=""):
         """finde Rueckwaerts im Baum von Pfad ausgehend, dass erste index.meta file          """finde Rueckwaerts im Baum von Pfad ausgehend, dass erste index.meta file
Line 70  class OSAS_storeOnlineServer(SimpleItem) Line 106  class OSAS_storeOnlineServer(SimpleItem)
   
     def isfile(self,path=""):      def isfile(self,path=""):
         """list dir"""          """list dir"""
         return os.path.isdir(path)          return os.path.isfile(path)
   
   
   
Line 78  class OSAS_storeOnlineServer(SimpleItem) Line 114  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 88  class OSAS_storeOnlineServer(SimpleItem) Line 125  class OSAS_storeOnlineServer(SimpleItem)
                   
         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 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):
     """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)

Removed from v.1.5  
changed lines
  Added in v.1.12


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