diff --git a/src/gen/proxy/filter.py b/src/gen/proxy/filter.py index baa9ac783..749a53197 100644 --- a/src/gen/proxy/filter.py +++ b/src/gen/proxy/filter.py @@ -4,6 +4,7 @@ # Copyright (C) 2007-2008 Brian G. Matherly # Copyright (C) 2008 Gary Burton # Copyright (C) 2008 Robert Cheramy +# Copyright (C) 2011 Tim G Lyons # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -51,7 +52,7 @@ class FilterProxyDb(ProxyDbBase): def __init__(self, db, person_filter=None, event_filter=None, note_filter=None): """ - Create a new PrivateProxyDb instance. + Create a new FilterProxyDb instance. """ ProxyDbBase.__init__(self, db) self.person_filter = person_filter @@ -143,6 +144,17 @@ class FilterProxyDb(ProxyDbBase): self.sanitize_notebase(source) return source + def get_citation_from_handle(self, handle): + """ + Finds a Citation in the database from the passed gramps' ID. + If no such Citation exists, None is returned. + """ + citation = self.db.get_citation_from_handle(handle) + # Filter notes out + + self.sanitize_notebase(citation) + return citation + def get_object_from_handle(self, handle): """ Finds a MediaObject in the database from the passed GRAMPS' handle. @@ -151,7 +163,6 @@ class FilterProxyDb(ProxyDbBase): media = self.db.get_object_from_handle(handle) # Filter notes out self.sanitize_notebase(media) - self.sanitize_sourcebase(media) return media def get_place_from_handle(self, handle): @@ -162,7 +173,6 @@ class FilterProxyDb(ProxyDbBase): place = self.db.get_place_from_handle(handle) # Filter notes out self.sanitize_notebase(place) - self.sanitize_sourcebase(place) return place def get_event_from_handle(self, handle): @@ -174,7 +184,6 @@ class FilterProxyDb(ProxyDbBase): event = self.db.get_event_from_handle(handle) # Filter all notes out self.sanitize_notebase(event) - self.sanitize_sourcebase(event) return event else: return None @@ -204,7 +213,6 @@ class FilterProxyDb(ProxyDbBase): # Filter notes out self.sanitize_notebase(family) - self.sanitize_sourcebase(family) return family else: return None @@ -275,6 +283,15 @@ class FilterProxyDb(ProxyDbBase): if source: return self.get_source_from_handle(source.get_handle()) + def get_citation_from_gramps_id(self, val): + """ + Finds a Citation in the database from the passed gramps' ID. + If no such Citation exists, None is returned. + """ + citation = self.db.get_citation_from_gramps_id(val) + if citation: + return self.get_citation_from_handle(citation.get_handle()) + def get_object_from_gramps_id(self, val): """ Finds a MediaObject in the database from the passed gramps' ID. @@ -458,23 +475,11 @@ class FilterProxyDb(ProxyDbBase): new_note_list = [ note for note in note_list if note in self.nlist ] notebase.set_note_list(new_note_list) - def sanitize_sourcebase(self, sourcebase): - """ - Filter notes out of an SourceBase object - @param event: SourceBase object to clean - @type event: SourceBase - """ - if sourcebase: - sources = sourcebase.get_source_references() - for source in sources: - self.sanitize_notebase(source) - def sanitize_addressbase(self, addressbase): if addressbase: addresses = addressbase.get_address_list() for address in addresses: self.sanitize_notebase(address) - self.sanitize_sourcebase(address) def sanitize_person(self, person): """ @@ -485,16 +490,13 @@ class FilterProxyDb(ProxyDbBase): if person: # Filter note references self.sanitize_notebase(person) - self.sanitize_sourcebase(person) self.sanitize_addressbase(person) name = person.get_primary_name() self.sanitize_notebase(name) - self.sanitize_sourcebase(name) altnames = person.get_alternate_names() for name in altnames: self.sanitize_notebase(name) - self.sanitize_sourcebase(name) self.sanitize_addressbase(person) diff --git a/src/gen/proxy/private.py b/src/gen/proxy/private.py index bd06bae29..eb5a6b64f 100644 --- a/src/gen/proxy/private.py +++ b/src/gen/proxy/private.py @@ -3,6 +3,7 @@ # # Copyright (C) 2007 Brian G. Matherly # Copyright (C) 2010 Nick Hall +# Copyright (C) 2011 Tim G Lyons # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -31,15 +32,17 @@ Proxy class for the GRAMPS databases. Filter out all data marked private. # #------------------------------------------------------------------------- from gen.ggettext import gettext as _ +import logging +LOG = logging.getLogger(".citation") #------------------------------------------------------------------------- # # GRAMPS libraries # #------------------------------------------------------------------------- -from gen.lib import (MediaRef, SourceRef, Attribute, Address, EventRef, +from gen.lib import (MediaRef, Attribute, Address, EventRef, Person, Name, Source, RepoRef, MediaObject, Place, Event, - Family, ChildRef, Repository, LdsOrd, Surname) + Family, ChildRef, Repository, LdsOrd, Surname, Citation) from proxybase import ProxyDbBase class PrivateProxyDb(ProxyDbBase): @@ -74,6 +77,16 @@ class PrivateProxyDb(ProxyDbBase): return sanitize_source(self.db, source) return None + def get_citation_from_handle(self, handle): + """ + Finds a Citation in the database from the passed gramps' ID. + If no such Citation exists, None is returned. + """ + citation = self.db.get_citation_from_handle(handle) + if citation and not citation.get_privacy(): + return sanitize_citation(self.db, citation) + return None + def get_object_from_handle(self, handle): """ Finds an Object in the database from the passed gramps' ID. @@ -184,6 +197,16 @@ class PrivateProxyDb(ProxyDbBase): return sanitize_source(self.db, source) return None + def get_citation_from_gramps_id(self, val): + """ + Finds a Citation in the database from the passed gramps' ID. + If no such Citation exists, None is returned. + """ + citation = self.db.get_citation_from_gramps_id(val) + if citation and not citation.get_privacy(): + return sanitize_citation(self.db, citation) + return None + def get_object_from_gramps_id(self, val): """ Finds a MediaObject in the database from the passed gramps' ID. @@ -244,6 +267,13 @@ class PrivateProxyDb(ProxyDbBase): obj = self.get_unfiltered_source(handle) return obj and not obj.get_privacy() + def include_citation(self, handle): + """ + Predicate returning True if object is to be included, else False + """ + obj = self.get_unfiltered_citation(handle) + return obj and not obj.get_privacy() + def include_place(self, handle): """ Predicate returning True if object is to be included, else False @@ -314,6 +344,15 @@ class PrivateProxyDb(ProxyDbBase): return True return False + def has_citation_handle(self, handle): + """ + returns True if the handle exists in the current Citation database. + """ + citation = self.db.get_citation_from_handle(handle) + if citation and not citation.get_privacy(): + return True + return False + def has_place_handle(self, handle): """ returns True if the handle exists in the current Place database. @@ -382,7 +421,7 @@ class PrivateProxyDb(ProxyDbBase): """ # This isn't done yet because it doesn't check if references are - # private (like a SourceRef or MediaRef). It only checks if the + # private (like a MediaRef). It only checks if the # referenced object is private. objects = { @@ -390,6 +429,7 @@ class PrivateProxyDb(ProxyDbBase): 'Family' : self.db.get_family_from_handle, 'Event' : self.db.get_event_from_handle, 'Source' : self.db.get_source_from_handle, + 'Citation' : self.db.get_citation_from_handle, 'Place' : self.db.get_place_from_handle, 'MediaObject' : self.db.get_object_from_handle, 'Note' : self.db.get_note_from_handle, @@ -426,25 +466,27 @@ def copy_media_ref_list(db, original_obj, clean_obj): if media_object and not media_object.get_privacy(): clean_obj.add_media_reference(sanitize_media_ref(db, media_ref)) -def copy_source_ref_list(db, original_obj, clean_obj): +def copy_citation_ref_list(db, original_obj, clean_obj): """ - Copies source references from one object to another - excluding private - references and references to private objects. + Copies citation references from one object to another - excluding references + to private citations, and references to citations that refer to private + sources. @param db: GRAMPS database to which the references belongs @type db: DbBase @param original_obj: Object that may have private references - @type original_obj: SourceBase + @type original_obj: CitationBase @param clean_obj: Object that will have only non-private references - @type original_obj: SourceBase + @type original_obj: CitationBase @returns: Nothing """ - for ref in original_obj.get_source_references(): - if ref and not ref.get_privacy(): - handle = ref.get_reference_handle() + for citation_handle in original_obj.get_citation_list(): + citation = db.get_citation_from_handle(citation_handle) + if citation and not citation.get_privacy(): + handle = citation.get_reference_handle() source = db.get_source_from_handle(handle) if source and not source.get_privacy(): - clean_obj.add_source_reference(sanitize_source_ref(db, ref)) + clean_obj.add_citation(citation_handle) def copy_notes(db, original_obj, clean_obj): """ @@ -504,7 +546,7 @@ def copy_attributes(db, original_obj, clean_obj): new_attribute.set_type(attribute.get_type()) new_attribute.set_value(attribute.get_value()) copy_notes(db, attribute, new_attribute) - copy_source_ref_list(db, attribute, new_attribute) + copy_citation_ref_list(db, attribute, new_attribute) clean_obj.add_attribute(new_attribute) def copy_urls(db, original_obj, clean_obj): @@ -589,7 +631,7 @@ def sanitize_lds_ord(db, lds_ord): if place and not place.get_privacy(): new_lds_ord.set_place_handle(place_handle) - copy_source_ref_list(db, lds_ord, new_lds_ord) + copy_citation_ref_list(db, lds_ord, new_lds_ord) copy_notes(db, lds_ord, new_lds_ord) return new_lds_ord @@ -620,7 +662,7 @@ def sanitize_address(db, address): new_address.set_phone(address.get_phone()) new_address.set_date_object(address.get_date_object()) - copy_source_ref_list(db, address, new_address) + copy_citation_ref_list(db, address, new_address) copy_notes(db, address, new_address) return new_address @@ -653,7 +695,7 @@ def sanitize_name(db, name): new_name.set_date_object(name.get_date_object()) new_name.set_surname_list(name.get_surname_list()) - copy_source_ref_list(db, name, new_name) + copy_citation_ref_list(db, name, new_name) copy_notes(db, name, new_name) return new_name @@ -678,32 +720,37 @@ def sanitize_media_ref(db, media_ref): new_ref.set_reference_handle(media_ref.get_reference_handle()) copy_notes(db, media_ref, new_ref) copy_attributes(db, media_ref, new_ref) - copy_source_ref_list(db, media_ref, new_ref) + copy_citation_ref_list(db, media_ref, new_ref) return new_ref -def sanitize_source_ref(db, source_ref): +def sanitize_citation(db, citation): """ - Create a new SourceRef instance based off the passed SourceRef + Create a new Citation instance based off the passed Citation instance. The returned instance has all private records removed from it. @param db: GRAMPS database to which the Person object belongs @type db: DbBase - @param source_ref: source SourceRef object that will be copied with + @param citation: source Citation object that will be copied with privacy records removed - @type source_ref: SourceRef - @returns: 'cleansed' SourceRef object - @rtype: SourceRef + @type citation: Citation + @returns: 'cleansed' Citation object + @rtype: Citation """ - new_ref = SourceRef() - new_ref.set_date_object(source_ref.get_date_object()) - new_ref.set_page(source_ref.get_page()) - new_ref.set_confidence_level(source_ref.get_confidence_level()) - new_ref.set_reference_handle(source_ref.get_reference_handle()) - copy_notes(db, source_ref, new_ref) + new_citation = Citation() + new_citation.set_date_object(citation.get_date_object()) + new_citation.set_page(citation.get_page()) + new_citation.set_confidence_level(citation.get_confidence_level()) + new_citation.set_reference_handle(citation.get_reference_handle()) + new_citation.set_data_map(citation.get_data_map()) + new_citation.set_gramps_id(citation.get_gramps_id()) + new_citation.set_handle(citation.get_handle()) + new_citation.set_change_time(citation.get_change_time()) + copy_notes(db, citation, new_citation) + copy_media_ref_list(db, citation, new_citation) - return new_ref + return new_citation def sanitize_event_ref(db, event_ref): """ @@ -812,7 +859,7 @@ def sanitize_person(db, person): copy_addresses(db, person, new_person) copy_attributes(db, person, new_person) - copy_source_ref_list(db, person, new_person) + copy_citation_ref_list(db, person, new_person) copy_urls(db, person, new_person) copy_media_ref_list(db, person, new_person) copy_lds_ords(db, person, new_person) @@ -883,7 +930,7 @@ def sanitize_media(db, media): new_media.set_date_object(media.get_date_object()) new_media.set_tag_list(media.get_tag_list()) - copy_source_ref_list(db, media, new_media) + copy_citation_ref_list(db, media, new_media) copy_attributes(db, media, new_media) copy_notes(db, media, new_media) @@ -914,7 +961,7 @@ def sanitize_place(db, place): new_place.set_main_location(place.get_main_location()) new_place.set_alternate_locations(place.get_alternate_locations()) - copy_source_ref_list(db, place, new_place) + copy_citation_ref_list(db, place, new_place) copy_notes(db, place, new_place) copy_media_ref_list(db, place, new_place) copy_urls(db, place, new_place) @@ -944,7 +991,7 @@ def sanitize_event(db, event): new_event.set_date_object(event.get_date_object()) new_event.set_change_time(event.get_change_time()) - copy_source_ref_list(db, event, new_event) + copy_citation_ref_list(db, event, new_event) copy_notes(db, event, new_event) copy_media_ref_list(db, event, new_event) copy_attributes(db, event, new_event) @@ -1006,7 +1053,7 @@ def sanitize_family(db, family): new_ref.set_father_relation(child_ref.get_father_relation()) new_ref.set_mother_relation(child_ref.get_mother_relation()) copy_notes(db, child_ref, new_ref) - copy_source_ref_list(db, child_ref, new_ref) + copy_citation_ref_list(db, child_ref, new_ref) new_family.add_child_ref(new_ref) # Copy event ref list. @@ -1016,7 +1063,7 @@ def sanitize_family(db, family): if event and not event.get_privacy(): new_family.add_event_ref(sanitize_event_ref(db, event_ref)) - copy_source_ref_list(db, family, new_family) + copy_citation_ref_list(db, family, new_family) copy_notes(db, family, new_family) copy_media_ref_list(db, family, new_family) copy_attributes(db, family, new_family) diff --git a/src/gen/proxy/proxybase.py b/src/gen/proxy/proxybase.py index 0bc945a60..3ddf65072 100644 --- a/src/gen/proxy/proxybase.py +++ b/src/gen/proxy/proxybase.py @@ -2,6 +2,7 @@ # Gramps - a GTK+/GNOME based genealogy program # # Copyright (C) 2007 Brian G. Matherly +# Copyright (C) 2011 Tim G Lyons # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -52,7 +53,7 @@ class ProxyDbBase(DbReadBase): def __init__(self, db): """ - Create a new PrivateProxyDb instance. + Create a new ProxyDb instance. """ self.db = self.basedb = db while isinstance(self.basedb, ProxyDbBase): @@ -95,6 +96,7 @@ class ProxyDbBase(DbReadBase): include_family = \ include_event = \ include_source = \ + include_citation = \ include_place = \ include_media_object = \ include_repository = \ @@ -142,6 +144,16 @@ class ProxyDbBase(DbReadBase): else: return [] + def get_citation_handles(self, sort_handles=False): + """ + Return a list of database handles, one handle for each Citation in + the database. + """ + if self.db.is_open: + return list(self.iter_citation_handles()) + else: + return [] + def get_place_handles(self, sort_handles=False): """ Return a list of database handles, one handle for each Place in @@ -228,6 +240,13 @@ class ProxyDbBase(DbReadBase): """ return ifilter(self.include_source, self.db.iter_source_handles()) + def iter_citation_handles(self): + """ + Return an iterator over database handles, one handle for each Citation + in the database. + """ + return ifilter(self.include_citation, self.db.iter_citation_handles()) + def iter_place_handles(self): """ Return an iterator over database handles, one handle for each Place in @@ -299,6 +318,12 @@ class ProxyDbBase(DbReadBase): """ return self.__iter_object(self.include_source, self.db.iter_sources) + def iter_citations(self): + """ + Return an iterator over Citation objects in the database + """ + return self.__iter_object(self.include_citation, self.db.iter_citations) + def iter_media_objects(self): """ Return an iterator over Media objects in the database @@ -390,6 +415,14 @@ class ProxyDbBase(DbReadBase): return self.gfilter(self.include_source, self.db.get_source_from_handle(handle)) + def get_citation_from_handle(self, handle): + """ + Finds a Citation in the database from the passed gramps handle. + If no such Citation exists, None is returned. + """ + return self.gfilter(self.include_citation, + self.db.get_citation_from_handle(handle)) + def get_place_from_handle(self, handle): """ Finds a Place in the database from the passed gramps handle. @@ -470,6 +503,14 @@ class ProxyDbBase(DbReadBase): return self.gfilter(self.include_source, self.db.get_source_from_gramps_id(val)) + def get_citation_from_gramps_id(self, val): + """ + Finds a Citation in the database from the passed gramps' ID. + If no such Citation exists, None is returned. + """ + return self.gfilter(self.include_citation, + self.db.get_citation_from_gramps_id(val)) + def get_object_from_gramps_id(self, val): """ Finds a MediaObject in the database from the passed gramps' ID. @@ -550,6 +591,12 @@ class ProxyDbBase(DbReadBase): """ return self.db.get_number_of_sources() + def get_number_of_citations(self): + """ + Return the number of Citations currently in the database. + """ + return self.db.get_number_of_citations() + def get_number_of_media_objects(self): """ Return the number of media objects currently in the database. @@ -666,6 +713,9 @@ class ProxyDbBase(DbReadBase): def get_raw_source_data(self, handle): return self.db.get_raw_source_data(handle) + def get_raw_citation_data(self, handle): + return self.db.get_raw_citation_data(handle) + def get_raw_repository_data(self, handle): return self.db.get_raw_repository_data(handle) @@ -703,6 +753,13 @@ class ProxyDbBase(DbReadBase): return self.gfilter(self.include_source, self.db.get_source_from_handle(handle)) is not None + def has_citation_handle(self, handle): + """ + returns True if the handle exists in the current Citation database. + """ + return self.gfilter(self.include_citation, + self.db.get_citation_from_handle(handle)) is not None + def has_place_handle(self, handle): """ returns True if the handle exists in the current Place database. diff --git a/src/gen/proxy/referenced.py b/src/gen/proxy/referenced.py index 0f3ac68b0..0d84d6cbb 100644 --- a/src/gen/proxy/referenced.py +++ b/src/gen/proxy/referenced.py @@ -2,6 +2,7 @@ # Gramps - a GTK+/GNOME based genealogy program # # Copyright (C) 2008 Gary Burton +# Copyright (C) 2011 Tim G Lyons # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -45,6 +46,7 @@ class ReferencedProxyDb(ProxyDbBase): ProxyDbBase.__init__(self, dbase) self.unreferenced_events = set() self.unreferenced_places = set() + self.unreferenced_citations = set() self.unreferenced_sources = set() self.unreferenced_repositories = set() self.unreferenced_media_objects = set() @@ -72,6 +74,12 @@ class ReferencedProxyDb(ProxyDbBase): """ return handle not in self.unreferenced_events + def include_citation(self, handle): + """ + Filter for citations + """ + return handle not in self.unreferenced_citations + def include_source(self, handle): """ Filter for sources @@ -126,6 +134,7 @@ class ReferencedProxyDb(ProxyDbBase): unref = { "Event" : self.unreferenced_events, "Place" : self.unreferenced_places, + "Citation" : self.unreferenced_citations, "Source" : self.unreferenced_sources, "Repository" : self.unreferenced_repositories, "MediaObject" : self.unreferenced_media_objects, @@ -156,6 +165,7 @@ class ReferencedProxyDb(ProxyDbBase): unrefs = ( (self.unreferenced_events, self.get_event_handles), (self.unreferenced_places, self.get_place_handles), + (self.unreferenced_citations, self.get_citation_handles), (self.unreferenced_sources, self.get_source_handles), (self.unreferenced_repositories, self.get_repository_handles), diff --git a/src/gen/proxy/referencedbyselection.py b/src/gen/proxy/referencedbyselection.py index 654e9d7c2..e36108d39 100644 --- a/src/gen/proxy/referencedbyselection.py +++ b/src/gen/proxy/referencedbyselection.py @@ -2,6 +2,7 @@ # Gramps - a GTK+/GNOME based genealogy program # # Copyright (C) 2010 Doug Blank +# Copyright (C) 2011 Tim G Lyons # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,7 +19,6 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# gen/proxy/referencedbyselection.py # $Id$ """ @@ -84,6 +84,7 @@ class ReferencedBySelectionProxyDb(ProxyDbBase): "Event": set(), "Place": set(), "Source": set(), + "Citation": set(), "Repository": set(), "MediaObject": set(), "Note": set(), @@ -111,6 +112,10 @@ class ReferencedBySelectionProxyDb(ProxyDbBase): obj = self.db.get_source_from_handle(handle) if obj: self.process_source(obj) + elif class_name == "Citation": + obj = self.db.get_citation_from_handle(handle) + if obj: + self.process_citation(obj) elif class_name == "Repository": obj = self.db.get_repository_from_handle(handle) if obj: @@ -175,7 +180,7 @@ class ReferencedBySelectionProxyDb(ProxyDbBase): self.process_addresses(person) self.process_attributes(person) - self.process_source_ref_list(person) + self.process_citation_ref_list(person) self.process_urls(person) self.process_media_ref_list(person) self.process_lds_ords(person) @@ -199,7 +204,7 @@ class ReferencedBySelectionProxyDb(ProxyDbBase): continue self.process_object("Person", child_ref.ref) self.process_notes(child_ref) - self.process_source_ref_list(child_ref) + self.process_citation_ref_list(child_ref) for event_ref in family.get_event_ref_list(): if event_ref: @@ -207,7 +212,7 @@ class ReferencedBySelectionProxyDb(ProxyDbBase): if event: self.process_event_ref(event_ref) - self.process_source_ref_list(family) + self.process_citation_ref_list(family) self.process_notes(family) self.process_media_ref_list(family) self.process_attributes(family) @@ -221,7 +226,7 @@ class ReferencedBySelectionProxyDb(ProxyDbBase): if event is None or event.handle in self.referenced["Event"]: return self.referenced["Event"].add(event.handle) - self.process_source_ref_list(event) + self.process_citation_ref_list(event) self.process_notes(event) self.process_media_ref_list(event) self.process_attributes(event) @@ -239,7 +244,7 @@ class ReferencedBySelectionProxyDb(ProxyDbBase): if place is None or place.handle in self.referenced["Place"]: return self.referenced["Place"].add(place.handle) - self.process_source_ref_list(place) + self.process_citation_ref_list(place) self.process_notes(place) self.process_media_ref_list(place) self.process_urls(place) @@ -262,6 +267,22 @@ class ReferencedBySelectionProxyDb(ProxyDbBase): self.process_media_ref_list(source) self.process_notes(source) + def process_citation(self, citation): + """ + Follow the citation object and find all of the primary objects + that it references. + """ + if citation is None or citation.handle in self.referenced["Citation"]: + return + self.referenced["Citation"].add(citation.handle) + source_handle = citation.get_reference_handle() + if source_handle: + source = self.db.get_source_from_handle(source_handle) + if source: + self.process_source(source) + self.process_media_ref_list(citation) + self.process_notes(citation) + def process_repository(self, repository): """ Follow the repository object and find all of the primary objects @@ -282,7 +303,7 @@ class ReferencedBySelectionProxyDb(ProxyDbBase): if media is None or media.handle in self.referenced["MediaObject"]: return self.referenced["MediaObject"].add(media.handle) - self.process_source_ref_list(media) + self.process_citation_ref_list(media) self.process_attributes(media) self.process_notes(media) @@ -316,7 +337,7 @@ class ReferencedBySelectionProxyDb(ProxyDbBase): def process_name(self, name): """ Find all of the primary objects referred to """ - self.process_source_ref_list(name) + self.process_citation_ref_list(name) self.process_notes(name) def process_addresses(self, original_obj): @@ -327,7 +348,7 @@ class ReferencedBySelectionProxyDb(ProxyDbBase): def process_address(self, address): """ Find all of the primary objects referred to """ - self.process_source_ref_list(address) + self.process_citation_ref_list(address) self.process_notes(address) def process_attributes(self, original_obj): @@ -335,23 +356,15 @@ class ReferencedBySelectionProxyDb(ProxyDbBase): for attribute in original_obj.get_attribute_list(): if attribute: self.process_notes(attribute) - self.process_source_ref_list(attribute) + self.process_citation_ref_list(attribute) - def process_source_ref_list(self, original_obj): + def process_citation_ref_list(self, original_obj): """ Find all of the primary objects referred to """ - for ref in original_obj.get_source_references(): - if ref: - handle = ref.get_reference_handle() - source = self.db.get_source_from_handle(handle) - if source: - self.process_source_ref(ref) - - def process_source_ref(self, srcref): - """ Find all of the primary objects referred to """ - source = self.db.get_source_from_handle(srcref.ref) - if source: - self.process_source(source) - self.process_notes(srcref) + for handle in original_obj.get_citation_list(): + if handle: + citation = self.db.get_citation_from_handle(handle) + if citation: + self.process_citation(citation) def process_urls(self, original_obj): """ Find all of the primary objects referred to """ @@ -363,7 +376,7 @@ class ReferencedBySelectionProxyDb(ProxyDbBase): if media_ref: self.process_notes(media_ref) self.process_attributes(media_ref) - self.process_source_ref_list(media_ref) + self.process_citation_ref_list(media_ref) handle = media_ref.get_reference_handle() media_object = self.db.get_object_from_handle(handle) if media_object: @@ -387,14 +400,14 @@ class ReferencedBySelectionProxyDb(ProxyDbBase): if place: self.process_place(place) - self.process_source_ref_list(lds_ord) + self.process_citation_ref_list(lds_ord) self.process_notes(lds_ord) def process_associations(self, original_obj): """ Find all of the primary objects referred to """ for person_ref in original_obj.get_person_ref_list(): if person_ref: - self.process_source_ref_list(person_ref) + self.process_citation_ref_list(person_ref) self.process_notes(person_ref) person = self.db.get_person_from_handle(person_ref.ref) if person: @@ -446,6 +459,12 @@ class ReferencedBySelectionProxyDb(ProxyDbBase): """ return handle in self.referenced["Source"] + def include_citation(self, handle): + """ + Filter for citations + """ + return handle in self.referenced["Citation"] + def include_repository(self, handle): """ Filter for repositories