Mercurial > hg > documentViewer
comparison documentViewer.py @ 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 | c048559460a3 |
comparison
equal
deleted
inserted
replaced
| 62:8a16ea8db858 | 63:4a17b755bfc7 |
|---|---|
| 337 bibtype=bibtype.replace("-"," ") # wrong typesiin index meta "-" instead of " " (not wrong! ROC) | 337 bibtype=bibtype.replace("-"," ") # wrong typesiin index meta "-" instead of " " (not wrong! ROC) |
| 338 docinfo['bib_type'] = bibtype | 338 docinfo['bib_type'] = bibtype |
| 339 bibmap=metaData.generateMappingForType(bibtype) | 339 bibmap=metaData.generateMappingForType(bibtype) |
| 340 # if there is no mapping bibmap is empty (mapping sometimes has empty fields) | 340 # if there is no mapping bibmap is empty (mapping sometimes has empty fields) |
| 341 if len(bibmap) > 0 and len(bibmap['author'][0]) > 0: | 341 if len(bibmap) > 0 and len(bibmap['author'][0]) > 0: |
| 342 docinfo['author']=getTextFromNode(dom.xpath("//bib/%s"%bibmap['author'][0])[0]) | 342 try: |
| 343 docinfo['title']=getTextFromNode(dom.xpath("//bib/%s"%bibmap['title'][0])[0]) | 343 docinfo['author']=getTextFromNode(dom.xpath("//bib/%s"%bibmap['author'][0])[0]) |
| 344 docinfo['year']=getTextFromNode(dom.xpath("//bib/%s"%bibmap['year'][0])[0]) | 344 except: pass |
| 345 try: | |
| 346 docinfo['title']=getTextFromNode(dom.xpath("//bib/%s"%bibmap['title'][0])[0]) | |
| 347 except: pass | |
| 348 try: | |
| 349 docinfo['year']=getTextFromNode(dom.xpath("//bib/%s"%bibmap['year'][0])[0]) | |
| 350 except: pass | |
| 345 logging.debug("documentViewer (getbibinfofromindexmeta) using mapping for %s"%bibtype) | 351 logging.debug("documentViewer (getbibinfofromindexmeta) using mapping for %s"%bibtype) |
| 346 try: | 352 try: |
| 347 docinfo['lang']=getTextFromNode(dom.xpath("//bib/lang")[0]) | 353 docinfo['lang']=getTextFromNode(dom.xpath("//bib/lang")[0]) |
| 348 except: | 354 except: |
| 349 docinfo['lang']='' | 355 docinfo['lang']='' |
| 424 | 430 |
| 425 presentationUrls=dom.xpath("//texttool/presentation") | 431 presentationUrls=dom.xpath("//texttool/presentation") |
| 426 docinfo = self.getBibinfoFromIndexMeta(url,docinfo=docinfo,dom=dom) # get info von bib tag | 432 docinfo = self.getBibinfoFromIndexMeta(url,docinfo=docinfo,dom=dom) # get info von bib tag |
| 427 | 433 |
| 428 if presentationUrls and (len(presentationUrls)>0): # ueberschreibe diese durch presentation informationen | 434 if presentationUrls and (len(presentationUrls)>0): # ueberschreibe diese durch presentation informationen |
| 429 # presentation url ergiebt sich ersetzen von index.meta in der url der fŸr die Metadaten | 435 # presentation url ergiebt sich ersetzen von index.meta in der url der fuer die Metadaten |
| 430 # durch den relativen Pfad auf die presentation infos | 436 # durch den relativen Pfad auf die presentation infos |
| 431 presentationUrl=url.replace('index.meta',getTextFromNode(presentationUrls[0])) | 437 presentationUrl=url.replace('index.meta',getTextFromNode(presentationUrls[0])) |
| 432 docinfo = self.getBibinfoFromTextToolPresentation(presentationUrl,docinfo=docinfo,dom=dom) | 438 docinfo = self.getBibinfoFromTextToolPresentation(presentationUrl,docinfo=docinfo,dom=dom) |
| 433 | 439 |
| 434 docinfo = self.getAuthinfoFromIndexMeta(url,docinfo=docinfo,dom=dom) # get access info | 440 docinfo = self.getAuthinfoFromIndexMeta(url,docinfo=docinfo,dom=dom) # get access info |
