--- ECHO_content/ECHO_resource.py 2009/04/14 16:32:00 1.4 +++ ECHO_content/ECHO_resource.py 2009/04/16 15:40:42 1.5 @@ -436,7 +436,7 @@ class ECHO_resource(CatalogAware,Folder, """create ImageUrl""" - resourcepath=readFieldFromXML(self.metalink,'resource','archive-path') + resourcepath=readFieldFromXML_xpath(self.metalink,'//resource/archive-path') digiliburlprefix=readFieldFromXML(self.metalink,'texttool','digiliburlprefix') images=readFieldFromXML(self.metalink,'texttool','image') @@ -455,7 +455,7 @@ class ECHO_resource(CatalogAware,Folder, def copyTitleToInfoXML(self,RESPONSE=None): """copy title from the resource""" presentationXML=readFieldFromXML(self.metalink,'texttool','presentation') - resourcepath=readFieldFromXML(self.metalink,'resource','archive-path') + resourcepath=readFieldFromXML_xpath(self.metalink,'//resource/archive-path') if (not presentationXML) or (not resourcepath): if RESPONSE: RESPONSE.write("Error: %s\n"%self.getId()) @@ -654,25 +654,16 @@ class ECHO_resource(CatalogAware,Folder, def getArchivePathFromMetadata(self): try: - fh=ECHO_helpers.urlopen(self.metalink) - dom=xml.dom.minidom.parse(fh) - archivePath=dom.getElementsByTagName('archive-path') - text = getText(archivePath[0].childNodes) - return text + archivePath=readFieldFromXML_xpath(self.metalink,"//resource/archive-path") + return archivePath except: return "" def getImageView(self,noredirect=None,onlyPath=None): """getImages; give Imageviewr and if somthing goes wrong.""" try: - fh=ECHO_helpers.urlopen(self.metalink) - dom=xml.dom.minidom.parse(fh) - texttools=dom.getElementsByTagName('texttool') - text=texttools[0].getElementsByTagName('image') - imagetemp=getText(text[0].childNodes) - - text=dom.getElementsByTagName('archive-path') - archivepath=getText(text[0].childNodes) + archivePath=readFieldFromXML_xpath(self.metalink,"//resource/archive-path") + archivepath=re.sub('/mpiwg/online/','',archivepath) imageurl="http://echo.mpiwg-berlin.mpg.de/zogilib?fn="+archivepath+"/"+imagetemp fh.close()