Diff for /OSA_system2/OSAS_browser.py between versions 1.2 and 1.3

version 1.2, 2004/12/23 08:30:55 version 1.3, 2004/12/23 10:48:28
Line 13  import os Line 13  import os
 import os.path  import os.path
 import stat  import stat
 import xml.dom.minidom  import xml.dom.minidom
   from types import *
   
 class OSAS_storeOnline(SimpleItem):  class OSAS_storeOnline(SimpleItem):
     """Webfrontend für das Storagesystem      """Webfrontend für das Storagesystem
Line 23  class OSAS_storeOnline(SimpleItem): Line 24  class OSAS_storeOnline(SimpleItem):
     security=ClassSecurityInfo()      security=ClassSecurityInfo()
   
     _v_fileSystem={} #chache fuer filesystem      _v_fileSystem={} #chache fuer filesystem
       _v_metaFiles={} #chache fuer indexMeta
           
     def __init__(self,id):      def __init__(self,id):
         """initialize a new instance"""          """initialize a new instance"""
Line 57  class OSAS_storeOnline(SimpleItem): Line 59  class OSAS_storeOnline(SimpleItem):
     def findEntryInIndexMeta(self,path):      def findEntryInIndexMeta(self,path):
         """fragm xml zum path          """fragm xml zum path
         @param path: Pfad auf das Object relativ zum rootFolderName          @param path: Pfad auf das Object relativ zum rootFolderName
         @return: den Teil von Index.meta der Informationen zu path enthaelt.          @return: den Teil von Index.meta der Informationen zu path enthaelt, None wenn error.
         """          """
   
         indexMeta=self.findIndexMeta(path)          indexMeta=self.findIndexMeta(path)
                   if not indexMeta:
               return None
         realPath=os.path.split(indexMeta)[0]          realPath=os.path.split(indexMeta)[0]
         path=os.path.normpath(os.path.join(self.rootFolderName,path))          path=os.path.normpath(os.path.join(self.rootFolderName,path))
                   
Line 123  class OSAS_storeOnline(SimpleItem): Line 126  class OSAS_storeOnline(SimpleItem):
         if path and (path[0]==os.sep):          if path and (path[0]==os.sep):
             path=path[1:]              path=path[1:]
   
           stats=os.stat(indexMeta)
   
           #teste ob schon im cache
           if self._v_metaFiles.has_key(indexMeta) and (self._v_metaFiles[indexMeta][0]==stats[stat.ST_MTIME]):
               
               return self._v_metaFiles[indexMeta][1]
                           
         dom=xml.dom.minidom.parse(indexMeta)          dom=xml.dom.minidom.parse(indexMeta)
   
Line 151  class OSAS_storeOnline(SimpleItem): Line 160  class OSAS_storeOnline(SimpleItem):
                 object=os.path.join(realPath,pathX,name)                  object=os.path.join(realPath,pathX,name)
                 ret[object]=(fileType,'')                  ret[object]=(fileType,'')
   
           self._v_metaFiles[indexMeta]=(stats[stat.ST_MTIME],ret) # speicher im chache
         return ret          return ret
   
                   
Line 161  class OSAS_storeOnline(SimpleItem): Line 170  class OSAS_storeOnline(SimpleItem):
         @return: metadata als html          @return: metadata als html
         """          """
         xmlInfos=self.findEntryInIndexMeta(path)          xmlInfos=self.findEntryInIndexMeta(path)
           if xmlInfos:
         return OSAS_helpers.getMetaInfoFromXML(path,xmlInfos)          return OSAS_helpers.getMetaInfoFromXML(path,xmlInfos)
                           else:
               return ""
         
   
     def readObjectsFromPath(self,path=""):      def readObjectsFromPath(self,path=""):
         """Liest files aus dem path und speichert im cache _v_filesystem.          """Liest files aus dem path und speichert im cache _v_filesystem.
          - to do: files aus metadaten  
   
         @param path : path relativ zum root folder des Storagesystems          @param path : path relativ zum root folder des Storagesystems
         @return: directory der Form [pfad zum Objekt] -> (fileType,metadatum als String)          @return: directory der Form [pfad zum Objekt] -> (fileType,metadatum als String)
Line 187  class OSAS_storeOnline(SimpleItem): Line 197  class OSAS_storeOnline(SimpleItem):
         stats=os.stat(realPath)          stats=os.stat(realPath)
   
         # teste ob schon im cache          # teste ob schon im cache
         #if self._v_fileSystem.has_key(realPath) and (self._v_fileSystem[realPath][0]==stats[stat.ST_MTIME]):          if self._v_fileSystem.has_key(realPath) and (self._v_fileSystem[realPath][0]==stats[stat.ST_MTIME]):
                           
         #    return self._v_fileSystem[realPath][1]              return self._v_fileSystem[realPath][1]
   
         dir=os.listdir(realPath)          dir=os.listdir(realPath)
         ret={}          ret={}
Line 298  class OSAS_storeOnline(SimpleItem): Line 308  class OSAS_storeOnline(SimpleItem):
   
     def getMetaFile(self,path):      def getMetaFile(self,path):
         """Lese Metafile ein"""          """Lese Metafile ein"""
         return OSAS_helpers.getMetaFile(self,path)          tmp=OSAS_helpers.getMetaFile(self,path)
           #zLOG.LOG("EE",zLOG.INFO,type(tmp))
           
           return tmp
   
 InitializeClass(OSAS_storeOnline)  InitializeClass(OSAS_storeOnline)
           

Removed from v.1.2  
changed lines
  Added in v.1.3


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