version 1.18, 2005/04/06 09:18:41
|
version 1.23, 2010/02/15 19:09:10
|
Line 8 from Products.PageTemplates.PageTemplate
|
Line 8 from Products.PageTemplates.PageTemplate
|
from OFS.Folder import Folder |
from OFS.Folder import Folder |
from OFS.SimpleItem import SimpleItem |
from OFS.SimpleItem import SimpleItem |
from Globals import InitializeClass,package_home |
from Globals import InitializeClass,package_home |
import zLOG |
|
|
import logging |
|
|
|
#ersetzt logging |
|
def logger(txt,method,txt2): |
|
"""logging""" |
|
logging.info(txt+ txt2) |
|
|
|
|
import base64 |
import base64 |
import bz2 |
import bz2 |
import os |
import os |
import os.path |
import os.path |
import stat |
import stat |
|
import Ft.Xml.XPath |
import xml.dom.minidom |
import xml.dom.minidom |
from types import * |
from types import * |
import xmlrpclib |
import xmlrpclib |
Line 24 def decodeRPC(string):
|
Line 33 def decodeRPC(string):
|
|
|
|
|
class OSAS_storeOnline(SimpleItem): |
class OSAS_storeOnline(SimpleItem): |
"""Webfrontend für das Storagesystem |
"""Webfrontend fuer das Storagesystem |
liefert Browserumgebung |
liefert Browserumgebung |
""" |
""" |
meta_type="OSAS_StoreOnline__neu" |
meta_type="OSAS_StoreOnline__neu" |
Line 158 class OSAS_storeOnline(SimpleItem):
|
Line 167 class OSAS_storeOnline(SimpleItem):
|
path=os.path.normpath(path) |
path=os.path.normpath(path) |
|
|
try: |
try: |
|
dom = NonvalidatingReader.parseString(server.getFile(indexMeta),"http://www.mpiwg-berlin.mpg.de/") |
|
|
dom=xml.dom.minidom.parseString(server.getFile(indexMeta)) |
|
except: |
except: |
zLOG.LOG("OSAS_browser (findEntryInIndexMeta)",zLOG.ERROR,"Cannot parse: %s"%indexMeta) |
logger("OSAS_browser (findEntryInIndexMeta)",logging.ERROR,"Cannot parse: %s"%indexMeta) |
return None |
return None |
|
|
path=path.replace(realPath,'') |
path=path.replace(realPath,'') |
Line 173 class OSAS_storeOnline(SimpleItem):
|
Line 182 class OSAS_storeOnline(SimpleItem):
|
searchPath=searchPath[1:] |
searchPath=searchPath[1:] |
#ist path ein directory? |
#ist path ein directory? |
xpath="/resource/dir[name='%s' and path='%s']"%(name,searchPath) |
xpath="/resource/dir[name='%s' and path='%s']"%(name,searchPath) |
|
dirs=Ft.Xml.XPath.Evaluate(xpath,contextNode=dom) |
|
|
dirs=xml.xpath.Evaluate(xpath,dom) |
|
|
|
if len(dirs)>0: |
if len(dirs)>0: |
return dirs[0].toxml |
return dirs[0].toxml |
Line 182 class OSAS_storeOnline(SimpleItem):
|
Line 191 class OSAS_storeOnline(SimpleItem):
|
#ist path ein file? |
#ist path ein file? |
xpath="/resource/file[name='%s' and path='%s']"%(name,searchPath) |
xpath="/resource/file[name='%s' and path='%s']"%(name,searchPath) |
|
|
dirs=xml.xpath.Evaluate(xpath,dom) |
|
|
|
|
dirs=Ft.Xml.XPath.Evaluate(xpath,contextNode=dom) |
if len(dirs)>0: |
if len(dirs)>0: |
return dirs[0].toxml() |
return dirs[0].toxml() |
|
|
Line 207 class OSAS_storeOnline(SimpleItem):
|
Line 216 class OSAS_storeOnline(SimpleItem):
|
|
|
realPath=os.path.split(indexMeta)[0] |
realPath=os.path.split(indexMeta)[0] |
path=path.replace(realPath,"") |
path=path.replace(realPath,"") |
if path and (path[0]==os.sep): #falls am Anfang os.sep steht lösche dieses. |
if path and (path[0]==os.sep): #falls am Anfang os.sep steht loesche dieses. |
path=path[1:] |
path=path[1:] |
|
|
|
|
|
|
#teste ob schon im cache zur Zeit kein chache wenn index.meta file nicht im selben ordner wie path. |
#teste ob schon im cache zur Zeit kein chache wenn index.meta file nicht im selben ordner wie path. |
|
|
if self._v_metaFiles.has_key(startPath) and (self._v_metaFiles[realPath][0]==stats[stat.ST_MTIME]) and (path==""): |
#if self._v_metaFiles.has_key(startPath) and (self._v_metaFiles[realPath][0]==stats[stat.ST_MTIME]) and (path==""): |
|
# |
return self._v_metaFiles[startPath][1] |
# return self._v_metaFiles[startPath][1] |
|
|
try: |
try: |
dom=xml.dom.minidom.parseString(server.getFile(indexMeta)) |
dom=xml.dom.minidom.parseString(server.getFile(indexMeta)) |
except: |
except: |
zLOG.LOG("OSAS_browser (getSubDirsFromIndexMeta)",zLOG.ERROR,"Cannot parse: %s"%indexMeta) |
logger("OSAS_browser (getSubDirsFromIndexMeta)",logging.ERROR,"Cannot parse: %s"%indexMeta) |
return ret |
return ret |
|
|
dirs=[] |
dirs=[] |
Line 297 class OSAS_storeOnline(SimpleItem):
|
Line 306 class OSAS_storeOnline(SimpleItem):
|
if metaDataId: |
if metaDataId: |
metaData=getattr(self,metaDataId) |
metaData=getattr(self,metaDataId) |
if not (getattr(metaData,'meta_type','')=='OSAS_Metadata__neu'): |
if not (getattr(metaData,'meta_type','')=='OSAS_Metadata__neu'): |
zLOG.LOG('OSAS_browser (readObjectsFromPath)',zLOG.ERROR,"%s is not OSAS_Metadata") |
logger('OSAS_browser (readObjectsFromPath)',logging.ERROR,"%s is not OSAS_Metadata") |
metaData=None |
metaData=None |
else: |
else: |
metaDatas=self.ZopeFind(self.aq_parent,obj_metatypes=['OSAS_Metadata__neu'],search_sub=1) |
metaDatas=self.ZopeFind(self.aq_parent,obj_metatypes=['OSAS_Metadata__neu'],search_sub=1) |
if metaDatas: |
if metaDatas: |
metaData=metaDatas[0][1] |
metaData=metaDatas[0][1] |
else: |
else: |
zLOG.LOG('OSAS_browser (readObjectsFromPath)',zLOG.INFO,"There is no OSAS_Metadata Object") |
logger('OSAS_browser (readObjectsFromPath)',logging.INFO,"There is no OSAS_Metadata Object") |
metaData=None |
metaData=None |
|
|
#print "md",metaData |
#print "md",metaData |
Line 320 class OSAS_storeOnline(SimpleItem):
|
Line 329 class OSAS_storeOnline(SimpleItem):
|
return None |
return None |
|
|
#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] |
|
|
indexMetas=server.getAllIndexMetasOfSubDirs(realPath) |
indexMetas=server.getAllIndexMetasOfSubDirs(realPath) |
dir=indexMetas.keys() |
dir=indexMetas.keys() |
Line 348 class OSAS_storeOnline(SimpleItem):
|
Line 357 class OSAS_storeOnline(SimpleItem):
|
|
|
if metaDataStr: |
if metaDataStr: |
display=metaData.getDisplayFieldsAsStr(metaDataStr) |
display=metaData.getDisplayFieldsAsStr(metaDataStr) |
dom=xml.dom.minidom.parseString(metaDataStr) |
|
|
|
if len(xml.xpath.Evaluate("/file/meta/video-file",dom))>0: |
dom = NonvalidatingReader.parseString(metaDataStr,"http://www.mpiwg-berlin.mpg.de/") |
|
if len(Ft.Xml.XPath.Evaluate("/file/meta/video-file",contextNode=dom))>0: |
fileType='OSAS_videoFile' |
fileType='OSAS_videoFile' |
|
|
else: |
else: |