--- OSAS/OSA_system/OSAS_Root.py 2005/04/27 13:17:45 1.18 +++ OSAS/OSA_system/OSAS_Root.py 2006/02/14 17:56:31 1.21 @@ -5,9 +5,13 @@ from OFS.Folder import Folder from Products.PageTemplates.PageTemplateFile import PageTemplateFile from Products.PageTemplates.PageTemplate import PageTemplate import urllib +import urlparse +import sys import zLOG import re import xml.dom.minidom +import os.path +from Globals import package_home class OSAS_ViewerObject(Folder): """Beschreibung eines Viewers""" @@ -28,7 +32,7 @@ class OSAS_ViewerObject(Folder): pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','changeViewerObjectForm.zpt')).__of__(self) return pt() - def changeViewerObject(self,title,prefix): + def changeViewerObject(self,title,prefix,RESPONSE=None): """Change RootFolderName""" self.title=title self.prefix=prefix @@ -101,9 +105,12 @@ class OSAS_Root(Folder,Implicit): """lade xml file""" #print "GI" #print xml_url - xmlneu=urllib.urlopen(xml_url).read() - - + try: + xmlneu=urllib.urlopen(xml_url).read() + except: + zLOG.LOG("OSASRoot (downloadExternalXML)", zLOG.INFO,"%s (%s)"%sys.exc_info()[0:2]) + zLOG.LOG("OSASRoot (downloadExternalXML)", zLOG.INFO,xml_url) + return "error" try: dom=xml.dom.minidom.parseString(xmlneu) except: @@ -111,18 +118,11 @@ class OSAS_Root(Folder,Implicit): return repr(xml_url) return "error" - path=re.sub(self.REQUEST['SERVER_URL'],'',index_meta_url) - path=re.sub('http://'+self.REQUEST['HTTP_HOST'],'',index_meta_url) + + #TODO: direct access to the file system necessary, fix that also xmlrpc to the server where the index file is stored is possible + parsedUrl=urlparse.urlparse(index_meta_url) + path=parsedUrl[2] - path=re.sub('http://foxridge.mpiwg-berlin.mpg.de:8080','',path) # falls foxridge als server - path=re.sub('http://foxridge.rz-berlin.mpg.de:8080','',path) # falls foxridge als server - path=re.sub('http://foxridge.rz-berlin.mpg.de','',path) # falls foxridge als server - - path=re.sub('http://foxridge.mpiwg-berlin.mpg.de','',path) # falls foxridge als server - path=re.sub('http://content.mpiwg-berlin.mpg.de','',path) # falls content als server - path=re.sub('http://vision.mpiwg-berlin.mpg.de','',path) # falls vision als server - path=re.sub('http://echo.mpiwg-berlin.mpg.de','',path) # falls echo -# path=re.sub('//','/',path) # falls echo fh=open(path,'w') zLOG.LOG("OSAS",zLOG.INFO,path) fh.write(xmlneu)