--- ECHO_content/ECHO_collection.py 2004/10/27 14:53:00 1.183
+++ ECHO_content/ECHO_collection.py 2004/10/27 16:05:55 1.185
@@ -1010,12 +1010,18 @@ class ECHO_resource(Folder,Persistent):
def createImageUrl(self,pn=1):
"""create ImageUrl"""
+
- resourcepath=readFieldFromXML(self.metalink,'resource','archive-path').replace('/mpiwg/online','')
+ resourcepath=readFieldFromXML(self.metalink,'resource','archive-path')
digiliburlprefix=readFieldFromXML(self.metalink,'texttool','digiliburlprefix')
images=readFieldFromXML(self.metalink,'texttool','image')
-
+
+
+ if (not resourcepath) or (not digiliburlprefix) or (not images):
+ zLOG.LOG("ECHO (createImageUrl)",zLOG.ERROR,"Cannot create ImageUrl for %s"%self.absolute_url())
+ return None
+ resourcepath=resourcepath.replace('/mpiwg/online','')
if not digiliburlprefix: digiliburlprefix="http://echo.mpiwg-berlin.mpg.de/zogilib?"
if (not images) or (not resourcepath): return None
@@ -1028,20 +1034,26 @@ class ECHO_resource(Folder,Persistent):
resourcepath=readFieldFromXML(self.metalink,'resource','archive-path')
if (not presentationXML) or (not resourcepath):
if RESPONSE:
- RESPONSE.write("Error: %s"%self.getId())
+ RESPONSE.write("Error: %s\n"%self.getId())
else:
- return None,self.getId()
+ return None,self.absolute_url()
+
+ try:
+ fh=file(os.path.join(resourcepath,presentationXML),'w')
+ fh.write("""
+
+ %s
+
+ yes
+ """%self.title)
+ fh.close()
+ return 1,self.getId()
+ except:
+ if RESPONSE:
+ RESPONSE.write("Error: %s\n"%self.getId())
+ else:
+ return None,self.absolute_url()
- print os.path.join(resourcepath,presentationXML)
- fh=file(os.path.join(resourcepath,presentationXML),'w')
- fh.write("""
-
- %s
-
- yes
- """%self.title)
- fh.close()
- return 1,self.getId()
def setStartPage(self,startpage=None,RESPONSE=None):
"""set start page, if no startpage defined use the generic one of the resource"""
@@ -1183,17 +1195,17 @@ class ECHO_resource(Folder,Persistent):
"""getFullTextXML; gives the FullText as an XML Document, and if somthing goes wrong."""
try:
- zLOG.LOG("ECHO Fulltext",zLOG.INFO,"open %s"%self.metalink)
+ #zLOG.LOG("ECHO Fulltext",zLOG.INFO,"open %s"%self.metalink)
fh=ECHO_helpers.urlopen(self.metalink)
- zLOG.LOG("ECHO Fulltext",zLOG.INFO,"opened %s"%self.metalink)
+ #zLOG.LOG("ECHO Fulltext",zLOG.INFO,"opened %s"%self.metalink)
dom=xml.dom.minidom.parse(fh)
texttools=dom.getElementsByTagName('texttool')
text=texttools[0].getElementsByTagName('text')
texturl=getText(text[0].childNodes)
- zLOG.LOG("ECHO Fulltext",zLOG.INFO,"found %s"%texturl)
+ #zLOG.LOG("ECHO Fulltext",zLOG.INFO,"found %s"%texturl)
fh.close()
- zLOG.LOG("ECHO Fulltext",zLOG.INFO,"closed fh")
+ #zLOG.LOG("ECHO Fulltext",zLOG.INFO,"closed fh")
#keine url
if not (texturl.split(":")[0] in ['http','ftp','file']):
if not noredirect:
@@ -2224,22 +2236,21 @@ class ECHO_collection(Folder, Persistent
author and date werden leer!!!
"""
- resources=self.ZopeFind(self,obj_metatypes=['ECHO_resource','ECHO_collection'])
-
+
+ resources=self.ZopeFind(self,obj_metatypes=['ECHO_resource'],search_sub=1)
+
for resource in resources:
- if resource[1].meta_type=="ECHO_collection":
-
- resource[1].copyTitleToInfoXMLFolder(RESPONSE)
- else:
ret,txt=resource[1].copyTitleToInfoXML()
if (not ret) and RESPONSE:
- RESPONSE.write("error: %s\n"%txt)
- if ret and RESPONSE:
- RESPONSE.write("ok: %s\n"%txt)
+ RESPONSE.write("error: %s\n"%txt)
+ if ret and RESPONSE:
+ RESPONSE.write("ok: %s\n"%txt)
- zLOG.LOG("ECHO",zLOG.INFO,txt)
+ #zLOG.LOG("ECHO (copyTitleToInfoXMLFolder)",zLOG.INFO,txt)
if RESPONSE is not None:
+ RESPONSE.write("done!\n")
+ RESPONSE.close()
RESPONSE.redirect('manage_main')
def copySearchFields(self,RESPONSE=None):