Changeset 37:ead830ce45d6 in documentViewer


Ignore:
Timestamp:
Apr 12, 2006, 6:53:00 PM (19 years ago)
Author:
casties
Branch:
default
Tags:
Root_roc_1
Message:

better error messages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • documentViewer.py

    r35 r37  
    178178                zLOG.LOG("documentViewer (getdirinfofromdigilib)", zLOG.ERROR, "error reading %s (try %d)"%(imageUrl,cnt))
    179179        else:
    180             raise IOError("Unable to get dirinfo from %s"%(imageUrl))
    181        
    182         params=dom.xpath("//dir/size")
    183         zLOG.LOG("documentViewer (getparamfromdigilib)", zLOG.INFO, "dirInfo:size"%params)
    184        
    185         if params:
    186             docinfo['numPages'] = int(getTextFromNode(params[0]))
     180            raise IOError("Unable to get dir-info from %s"%(imageUrl))
     181       
     182        sizes=dom.xpath("//dir/size")
     183        zLOG.LOG("documentViewer (getparamfromdigilib)", zLOG.INFO, "dirInfo:size"%sizes)
     184       
     185        if sizes:
     186            docinfo['numPages'] = int(getTextFromNode(sizes[0]))
    187187        else:
    188188            docinfo['numPages'] = 0
     
    200200            except:
    201201                zLOG.LOG("documentViewer (getIndexMata)", zLOG.INFO,"%s (%s)"%sys.exc_info()[0:2])
    202                 raise IOError("Unable to get info from %s"%(url))
     202                raise IOError("Unable to read index.meta from %s"%(url))
    203203        else:
    204204            # online path
     
    211211            except:
    212212                zLOG.LOG("documentViewer (getIndexMata)", zLOG.INFO,"%s (%s)"%sys.exc_info()[0:2])
    213                 raise IOError("Unable to get info from %s"%(url))
     213                raise IOError("Unable to read index meta from %s"%(url))
    214214                 
    215215        return dom
     
    218218    def getAuthinfoFromIndexMeta(self,path,docinfo=None,dom=None):
    219219        """gets authorization info from the index.meta file at path or given by dom"""
    220         zLOG.LOG("documentViewer (getbibinfofromindexmeta)", zLOG.INFO,"path: %s"%(path))
     220        zLOG.LOG("documentViewer (getauthinfofromindexmeta)", zLOG.INFO,"path: %s"%(path))
    221221       
    222222        access = None
     
    294294           imageDir=getTextFromNode(imageDirs[0])
    295295       else:
    296            imageDir=None
     296           # we balk with no image tag
     297           raise IOError("No text-tool info in %s"%(url))
    297298           
    298299       if imageDir and archivePath:
     
    353354        else:
    354355            zLOG.LOG("documentViewer (getdocinfo)", zLOG.ERROR,"unknown mode!")
     356            raise ValueError("Unknown mode %s"%(mode))
     357                       
    355358        zLOG.LOG("documentViewer (getdocinfo)", zLOG.INFO,"docinfo: %s"%docinfo)
    356359        self.REQUEST.SESSION['docinfo'] = docinfo
Note: See TracChangeset for help on using the changeset viewer.