Changeset 454:73e3273c7624 in documentViewer


Ignore:
Timestamp:
Jul 15, 2011, 9:02:26 AM (13 years ago)
Author:
casties
Branch:
elementtree
Message:

more work

File:
1 edited

Legend:

Unmodified
Added
Removed
  • documentViewer.py

    r453 r454  
    500500       
    501501        for x in range(cut):
    502                
    503                 path=getParentDir(path)
     502            path=getParentDir(path)
    504503       
    505504        infoUrl=self.digilibBaseUrl+"/dirInfo-xml.jsp?mo=dir&fn="+path
     
    631630        logging.debug("documentViewer (getbibinfofromindexmeta cutted) path: %s"%(path))
    632631        # put in all raw bib fields as dict "bib"
    633         bib = dom.find(".//bib/*")
     632        bib = dom.find(".//bib")
    634633        #bib = dom.xpath("//bib/*")
    635         if bib and len(bib)>0:
     634        if bib is not None:
    636635            bibinfo = {}
    637636            for e in bib:
    638                 bibinfo[e.localName] = getTextFromNode(e)
     637                bibinfo[e.tag] = getText(e)
     638               
    639639            docinfo['bib'] = bibinfo
    640640       
    641641        # extract some fields (author, title, year) according to their mapping
    642642        metaData=self.metadata.main.meta.bib
    643         bib = dom.find(".//bib")
    644643        bibtype=bib.get("type")
    645644        #bibtype=dom.xpath("//bib/@type")
     
    712711        return docinfo
    713712   
    714      
     713   
     714    # TODO: is this needed?
    715715    def getNameFromIndexMeta(self,path,docinfo=None,dom=None,cut=0):
    716716        """gets name info from the index.meta file at path or given by dom"""
     
    740740        archiveName = None
    741741   
    742         archiveName = getTextFromNode(dom.find("name"))
     742        archiveName = getText(dom.find("name"))
    743743        if not archiveName:
    744744            logging.warning("documentViewer (getdocinfofromtexttool) resource/name missing in: %s" % (url))
    745745       
    746         archivePath = getTextFromNode(dom.find("archive-path"))
     746        archivePath = getText(dom.find("archive-path"))
    747747        if archivePath:
    748748            # clean up archive path
     
    808808        presentationUrl = getText(dom.find(".//texttool/presentation"))
    809809        docinfo = self.getBibinfoFromIndexMeta(url, docinfo=docinfo, dom=dom)   # get info von bib tag
     810        # TODO: is this needed here?
    810811        docinfo = self.getNameFromIndexMeta(url, docinfo=docinfo, dom=dom)
    811812       
     
    831832        """
    832833        dom=self.getPresentationInfoXML(url)
    833         try:
    834             docinfo['author']=getText(dom.find(".//author"))
    835         except:
    836             pass
    837         try:
    838             docinfo['title']=getText(dom.find(".//title"))
    839         except:
    840             pass
    841         try:
    842             docinfo['year']=getText(dom.find(".//date"))
    843         except:
    844             pass
     834        docinfo['author']=getText(dom.find(".//author"))
     835        docinfo['title']=getText(dom.find(".//title"))
     836        docinfo['year']=getText(dom.find(".//date"))
    845837        return docinfo
    846838   
Note: See TracChangeset for help on using the changeset viewer.