changeset 40:749ee5389892

try to ignore superfluous /mpiwg/online in urls
author casties
date Wed, 14 Jun 2006 18:24:10 +0200
parents 1dd90aabd366
children 0c8ee8fcfd76
files documentViewer.py
diffstat 1 files changed, 12 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/documentViewer.py	Tue Jun 13 17:21:47 2006 +0200
+++ b/documentViewer.py	Wed Jun 14 18:24:10 2006 +0200
@@ -163,21 +163,24 @@
                 
     def getDirinfoFromDigilib(self,path,docinfo=None):
         """gibt param von dlInfo aus"""
+        num_retries = 3
         if docinfo is None:
             docinfo = {}
             
-        imageUrl=self.digilibBaseUrl+"/dirInfo-xml.jsp?mo=dir&fn="+path
+        infoUrl=self.digilibBaseUrl+"/dirInfo-xml.jsp?mo=dir&fn="+path
     
-        zLOG.LOG("documentViewer (getparamfromdigilib)", zLOG.INFO, "dirInfo from %s"%(imageUrl))
+        zLOG.LOG("documentViewer (getparamfromdigilib)", zLOG.INFO, "dirInfo from %s"%(infoUrl))
         
-        for cnt in (1,2,3):
+        for cnt in range(num_retries):
             try:
-                dom = NonvalidatingReader.parseUri(imageUrl)
+                # dom = NonvalidatingReader.parseUri(imageUrl)
+                txt=urllib.urlopen(infoUrl).read()
+                dom = Parse(txt)
                 break
             except:
-                zLOG.LOG("documentViewer (getdirinfofromdigilib)", zLOG.ERROR, "error reading %s (try %d)"%(imageUrl,cnt))
+                zLOG.LOG("documentViewer (getdirinfofromdigilib)", zLOG.ERROR, "error reading %s (try %d)"%(infoUrl,cnt))
         else:
-            raise IOError("Unable to get dir-info from %s"%(imageUrl))
+            raise IOError("Unable to get dir-info from %s"%(infoUrl))
         
         sizes=dom.xpath("//dir/size")
         zLOG.LOG("documentViewer (getparamfromdigilib)", zLOG.INFO, "dirInfo:size"%sizes)
@@ -201,16 +204,17 @@
         else:
             # online path
             server=self.digilibBaseUrl+"/servlet/Texter?fn="
-            metaUrl=server+url
+            metaUrl=server+url.replace("/mpiwg/online","")
             if not metaUrl.endswith("index.meta"):
                 metaUrl += "/index.meta"
         
-        for n in range(num_retries):
+        for cnt in range(num_retries):
             try:
                 # patch dirk encoding fehler treten dann nicht mehr auf
                 # dom = NonvalidatingReader.parseUri(metaUrl)
                 txt=urllib.urlopen(metaUrl).read()
                 dom = Parse(txt)
+                break
             except:
                 zLOG.LOG("ERROR documentViewer (getIndexMata)", zLOG.INFO,"%s (%s)"%sys.exc_info()[0:2])