# HG changeset patch # User casties # Date 1150302250 -7200 # Node ID 749ee5389892a88d6e78004dadf313998045a587 # Parent 1dd90aabd3660a1234e7a4f4e797f2c78a271e5c try to ignore superfluous /mpiwg/online in urls diff -r 1dd90aabd366 -r 749ee5389892 documentViewer.py --- 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])