Changeset 70:0049d64aa464 in documentViewer


Ignore:
Timestamp:
Nov 4, 2008, 7:51:35 PM (16 years ago)
Author:
dwinter
Branch:
default
Message:

filepath introduced

File:
1 edited

Legend:

Unmodified
Added
Removed
  • documentViewer.py

    r68 r70  
    333333                       
    334334       
    335     def getAuthinfoFromIndexMeta(self,path,docinfo=None,dom=None):
     335    def getAuthinfoFromIndexMeta(self,path,docinfo=None,dom=None,cut=0):
    336336        """gets authorization info from the index.meta file at path or given by dom"""
    337337        logger("documentViewer (getauthinfofromindexmeta)", logging.INFO,"path: %s"%(path))
     
    343343           
    344344        if dom is None:
    345             dom = self.getIndexMeta(getParentDir(path))
     345            for x in range(cut+1):
     346                path=getParentDir(path)
     347            dom = self.getIndexMeta(path)
    346348       
    347349        acctype = dom.xpath("//access-conditions/access/@type")
     
    355357   
    356358       
    357     def getBibinfoFromIndexMeta(self,path,docinfo=None,dom=None):
     359    def getBibinfoFromIndexMeta(self,path,docinfo=None,dom=None,cut=0):
    358360        """gets bibliographical info from the index.meta file at path or given by dom"""
    359361        logging.debug("documentViewer (getbibinfofromindexmeta) path: %s"%(path))
     
    363365           
    364366        if dom is None:
    365             dom = self.getIndexMeta(getParentDir(path))
     367            for x in range(cut+1):
     368                path=getParentDir(path)
     369            dom = self.getIndexMeta(path)
    366370           
    367371        # put in all raw bib fields as dict "bib"
     
    509513        return docinfo
    510514   
    511     def getDocinfoFromImagePath(self,path,docinfo=None):
     515    def getDocinfoFromImagePath(self,path,docinfo=None,cut=0):
    512516        """path ist the path to the images it assumes that the index.meta file is one level higher."""
    513517        logger("documentViewer (getdocinfofromimagepath)", logging.INFO,"path: %s"%(path))
     
    520524        docinfo['imageURL'] = imageUrl
    521525       
    522         docinfo = self.getBibinfoFromIndexMeta(path,docinfo=docinfo)
    523         docinfo = self.getAuthinfoFromIndexMeta(path,docinfo=docinfo)
     526        docinfo = self.getBibinfoFromIndexMeta(path,docinfo=docinfo,cut=cut)
     527        docinfo = self.getAuthinfoFromIndexMeta(path,docinfo=docinfo,cut=cut)
    524528        return docinfo
    525529   
     
    541545        elif mode=="imagepath":
    542546            docinfo = self.getDocinfoFromImagePath(url, docinfo=docinfo)
     547        elif mode=="filepath":
     548            docinfo = self.getDocinfoFromImagePath(url, docinfo=docinfo,cut=1)
    543549        else:
    544550            logger("documentViewer (getdocinfo)", logging.ERROR,"unknown mode!")
Note: See TracChangeset for help on using the changeset viewer.