Added a conditional to make sure that there was a citation before creating hyper links.

svn: r18702
This commit is contained in:
Rob G. Healey 2012-01-04 21:17:56 +00:00
parent fcebd9085d
commit ec0e3724c6

View File

@ -713,29 +713,27 @@ class BasePage(object):
@param: citation_handle_list = list of gen/lib/Citation @param: citation_handle_list = list of gen/lib/Citation
""" """
lnk = (self.report.cur_fname, self.page_title, self.gid) lnk = (self.report.cur_fname, self.page_title, self.gid)
text = "" text = ""
for citation_handle in citation_handle_list: for citation_handle in citation_handle_list:
citation = self.report.database.get_citation_from_handle( citation = self.report.database.get_citation_from_handle(
citation_handle) citation_handle)
if citation:
# Add the source information to src_list for use when displaying the # Add the source information to src_list for use when displaying the
# Sources page # Sources page
source_handle = citation.get_reference_handle() source_handle = citation.get_reference_handle()
if source_handle in self.src_list: if source_handle in self.src_list:
if lnk not in self.src_list[source_handle]: if lnk not in self.src_list[source_handle]:
self.src_list[source_handle].append(lnk) self.src_list[source_handle].append(lnk)
else: else:
self.src_list[source_handle] = [lnk] self.src_list[source_handle] = [lnk]
# Add the citation information to the bibliography, and construct # Add the citation information to the bibliography, and construct
# the citation reference text # the citation reference text
index, key = self.bibli.add_reference(citation) index, key = self.bibli.add_reference(citation)
id_ = "%d%s" % (index+1, key) id_ = "%d%s" % (index+1, key)
text += ' [<a href="#sref%s">%s</a>]' % (id_, id_) text += ' [<a href="#sref%s">%s</a>]' % (id_, id_)
# return citation list text to its callers
return text return text
def get_note_format(self, note, link_prefix_up): def get_note_format(self, note, link_prefix_up):