Update uses of get_source_referents to handle citations:

* implement new Utils get_source_and_citation_referents
* Update sourceview.py and citationtreeview.py to use it
* Fix editsource.py, where deletion of a source object was not properly dealing with all possible citations
* Update mediaobj.py which still had a remnant of a source_list
* fix _HasTextMatchingSubstringOf filter to deal with text in both sources and citations

svn: r18394
This commit is contained in:
Tim G L Lyons
2011-11-01 11:10:18 +00:00
parent 9c046f38a0
commit 4169661302
6 changed files with 124 additions and 137 deletions

View File

@ -420,24 +420,8 @@ class CitationTreeView(ListView):
is_used = any(the_lists)
return (query, is_used, object)
else:
# FIXME: this is copied from SourceView, because import with
# from plugins.view.sourceview import SourceView
# doesn't seem to work!
the_lists = Utils.get_source_referents(handle, self.dbstate.db)
LOG.debug('source referents %s' % [the_lists])
citation_referents_list = []
for citation in the_lists[7]:
LOG.debug('citation %s' % citation)
refs = Utils.get_citation_referents(citation, self.dbstate.db)
citation_referents_list += [(citation, refs)]
LOG.debug('citation_referents_list %s' % [citation_referents_list])
(person_list, family_list, event_list, place_list, source_list,
media_list, repo_list, citation_list) = the_lists
the_lists = (person_list, family_list, event_list, place_list,
source_list, media_list, repo_list, citation_list,
citation_referents_list)
the_lists = Utils.get_source_and_citation_referents(handle,
self.dbstate.db)
LOG.debug('the_lists %s' % [the_lists])
object = self.dbstate.db.get_source_from_handle(handle)