Mercurial > hg > documentViewer
changeset 63:4a17b755bfc7
added more try/excepts to bib-meta reading code
author | casties |
---|---|
date | Fri, 22 Jun 2007 18:02:55 +0200 |
parents | 8a16ea8db858 |
children | d928e4820b93 |
files | documentViewer.py |
diffstat | 1 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/documentViewer.py Fri Jun 15 16:16:27 2007 +0200 +++ b/documentViewer.py Fri Jun 22 18:02:55 2007 +0200 @@ -339,9 +339,15 @@ bibmap=metaData.generateMappingForType(bibtype) # if there is no mapping bibmap is empty (mapping sometimes has empty fields) if len(bibmap) > 0 and len(bibmap['author'][0]) > 0: - docinfo['author']=getTextFromNode(dom.xpath("//bib/%s"%bibmap['author'][0])[0]) - docinfo['title']=getTextFromNode(dom.xpath("//bib/%s"%bibmap['title'][0])[0]) - docinfo['year']=getTextFromNode(dom.xpath("//bib/%s"%bibmap['year'][0])[0]) + try: + docinfo['author']=getTextFromNode(dom.xpath("//bib/%s"%bibmap['author'][0])[0]) + except: pass + try: + docinfo['title']=getTextFromNode(dom.xpath("//bib/%s"%bibmap['title'][0])[0]) + except: pass + try: + docinfo['year']=getTextFromNode(dom.xpath("//bib/%s"%bibmap['year'][0])[0]) + except: pass logging.debug("documentViewer (getbibinfofromindexmeta) using mapping for %s"%bibtype) try: docinfo['lang']=getTextFromNode(dom.xpath("//bib/lang")[0]) @@ -426,7 +432,7 @@ docinfo = self.getBibinfoFromIndexMeta(url,docinfo=docinfo,dom=dom) # get info von bib tag if presentationUrls and (len(presentationUrls)>0): # ueberschreibe diese durch presentation informationen - # presentation url ergiebt sich ersetzen von index.meta in der url der fŸr die Metadaten + # presentation url ergiebt sich ersetzen von index.meta in der url der fuer die Metadaten # durch den relativen Pfad auf die presentation infos presentationUrl=url.replace('index.meta',getTextFromNode(presentationUrls[0])) docinfo = self.getBibinfoFromTextToolPresentation(presentationUrl,docinfo=docinfo,dom=dom)