Changeset 40:749ee5389892 in documentViewer


Ignore:
Timestamp:
Jun 14, 2006, 4:24:10 PM (18 years ago)
Author:
casties
Branch:
default
Message:

try to ignore superfluous /mpiwg/online in urls

File:
1 edited

Legend:

Unmodified
Added
Removed
  • documentViewer.py

    r39 r40  
    164164    def getDirinfoFromDigilib(self,path,docinfo=None):
    165165        """gibt param von dlInfo aus"""
     166        num_retries = 3
    166167        if docinfo is None:
    167168            docinfo = {}
    168169           
    169         imageUrl=self.digilibBaseUrl+"/dirInfo-xml.jsp?mo=dir&fn="+path
    170    
    171         zLOG.LOG("documentViewer (getparamfromdigilib)", zLOG.INFO, "dirInfo from %s"%(imageUrl))
    172        
    173         for cnt in (1,2,3):
     170        infoUrl=self.digilibBaseUrl+"/dirInfo-xml.jsp?mo=dir&fn="+path
     171   
     172        zLOG.LOG("documentViewer (getparamfromdigilib)", zLOG.INFO, "dirInfo from %s"%(infoUrl))
     173       
     174        for cnt in range(num_retries):
    174175            try:
    175                 dom = NonvalidatingReader.parseUri(imageUrl)
     176                # dom = NonvalidatingReader.parseUri(imageUrl)
     177                txt=urllib.urlopen(infoUrl).read()
     178                dom = Parse(txt)
    176179                break
    177180            except:
    178                 zLOG.LOG("documentViewer (getdirinfofromdigilib)", zLOG.ERROR, "error reading %s (try %d)"%(imageUrl,cnt))
    179         else:
    180             raise IOError("Unable to get dir-info from %s"%(imageUrl))
     181                zLOG.LOG("documentViewer (getdirinfofromdigilib)", zLOG.ERROR, "error reading %s (try %d)"%(infoUrl,cnt))
     182        else:
     183            raise IOError("Unable to get dir-info from %s"%(infoUrl))
    181184       
    182185        sizes=dom.xpath("//dir/size")
     
    202205            # online path
    203206            server=self.digilibBaseUrl+"/servlet/Texter?fn="
    204             metaUrl=server+url
     207            metaUrl=server+url.replace("/mpiwg/online","")
    205208            if not metaUrl.endswith("index.meta"):
    206209                metaUrl += "/index.meta"
    207210       
    208         for n in range(num_retries):
     211        for cnt in range(num_retries):
    209212            try:
    210213                # patch dirk encoding fehler treten dann nicht mehr auf
     
    212215                txt=urllib.urlopen(metaUrl).read()
    213216                dom = Parse(txt)
     217                break
    214218            except:
    215219                zLOG.LOG("ERROR documentViewer (getIndexMata)", zLOG.INFO,"%s (%s)"%sys.exc_info()[0:2])
Note: See TracChangeset for help on using the changeset viewer.