Avoid loop in narrativeweb with citation, source, and media.

This commit is contained in:
SNoiraud 2017-08-20 23:50:08 +02:00
parent 08aee19e5e
commit 73f2f05b26

View File

@ -833,6 +833,8 @@ class NavWebReport(Report):
@param: bkref_class -- The class associated to this handle (source)
@param: bkref_handle -- The handle associated to this source
"""
if not self.obj_dict[Source][source_handle]:
return
source = self._db.get_source_from_handle(source_handle)
source_name = source.get_title()
#if isinstance(source_name, bytes):
@ -866,6 +868,8 @@ class NavWebReport(Report):
@param: bkref_class -- The class associated to this handle
@param: bkref_handle -- The handle associated to this citation
"""
if not self.obj_dict[Citation][citation_handle]:
return
citation = self._db.get_citation_from_handle(citation_handle)
# If Page is none, we want to make sure that a tuple is generated for
# the source backreference
@ -895,6 +899,8 @@ class NavWebReport(Report):
@param: bkref_class -- The class associated to this handle (media)
@param: bkref_handle -- The handle associated to this media
"""
if not self.obj_dict[Media][media_handle]:
return
media_refs = self.bkref_dict[Media].get(media_handle)
if media_refs and (bkref_class, bkref_handle) in media_refs:
return
@ -932,6 +938,8 @@ class NavWebReport(Report):
@param: bkref_class -- The class associated to this handle (source)
@param: bkref_handle -- The handle associated to this source
"""
if not self.obj_dict[Repository][repos_handle]:
return
repos = self._db.get_repository_from_handle(repos_handle)
repos_name = repos.name
if self.inc_repository: