0006544: No test for checking if Place handle exists when looking at media reference via proxy

svn: r21796
This commit is contained in:
Tim G L Lyons 2013-03-28 18:28:44 +00:00
parent 645262992d
commit 6fe6455251
2 changed files with 56 additions and 36 deletions

View File

@ -139,6 +139,8 @@ class FilterProxyDb(ProxyDbBase):
If no such Source exists, None is returned.
"""
source = self.db.get_source_from_handle(handle)
if source:
# Filter notes out
self.sanitize_notebase(source)
@ -153,7 +155,6 @@ class FilterProxyDb(ProxyDbBase):
for repo_ref in repo_ref_list:
self.sanitize_notebase(repo_ref)
return source
def get_citation_from_handle(self, handle):
@ -163,7 +164,6 @@ class FilterProxyDb(ProxyDbBase):
"""
citation = self.db.get_citation_from_handle(handle)
# Filter notes out
self.sanitize_notebase(citation)
return citation
@ -173,6 +173,8 @@ class FilterProxyDb(ProxyDbBase):
If no such Object exists, None is returned.
"""
media = self.db.get_object_from_handle(handle)
if media:
# Filter notes out
self.sanitize_notebase(media)
@ -188,6 +190,8 @@ class FilterProxyDb(ProxyDbBase):
If no such Place exists, None is returned.
"""
place = self.db.get_place_from_handle(handle)
if place:
# Filter notes out
self.sanitize_notebase(place)
@ -297,6 +301,8 @@ class FilterProxyDb(ProxyDbBase):
person = self.db.get_person_from_gramps_id(val)
if person:
return self.get_person_from_handle(person.get_handle())
else:
return None
def get_family_from_gramps_id(self, val):
"""
@ -306,6 +312,8 @@ class FilterProxyDb(ProxyDbBase):
family = self.db.get_family_from_gramps_id(val)
if family:
return self.get_family_from_handle(family.get_handle())
else:
return None
def get_event_from_gramps_id(self, val):
"""
@ -315,6 +323,8 @@ class FilterProxyDb(ProxyDbBase):
event = self.db.get_event_from_gramps_id(val)
if event:
return self.get_event_from_handle(event.get_handle())
else:
return None
def get_place_from_gramps_id(self, val):
"""
@ -324,6 +334,8 @@ class FilterProxyDb(ProxyDbBase):
place = self.db.get_place_from_gramps_id(val)
if place:
return self.get_place_from_handle(place.get_handle())
else:
return None
def get_source_from_gramps_id(self, val):
"""
@ -333,6 +345,8 @@ class FilterProxyDb(ProxyDbBase):
source = self.db.get_source_from_gramps_id(val)
if source:
return self.get_source_from_handle(source.get_handle())
else:
return None
def get_citation_from_gramps_id(self, val):
"""
@ -342,6 +356,8 @@ class FilterProxyDb(ProxyDbBase):
citation = self.db.get_citation_from_gramps_id(val)
if citation:
return self.get_citation_from_handle(citation.get_handle())
else:
return None
def get_object_from_gramps_id(self, val):
"""
@ -351,6 +367,8 @@ class FilterProxyDb(ProxyDbBase):
media = self.db.get_object_from_gramps_id(val)
if media:
return self.get_object_from_handle(media.get_handle())
else:
return None
def get_repository_from_gramps_id(self, val):
"""
@ -360,6 +378,8 @@ class FilterProxyDb(ProxyDbBase):
repository = self.db.get_repository_from_gramps_id(val)
if repository:
return self.get_repository_from_handle(repository.get_handle())
else:
return None
def get_note_from_gramps_id(self, val):
"""
@ -369,6 +389,8 @@ class FilterProxyDb(ProxyDbBase):
note = self.db.get_note_from_gramps_id(val)
if note:
return self.get_note_from_handle(note.get_handle())
else:
return None
def get_person_handles(self, sort_handles=False):
"""

View File

@ -232,13 +232,10 @@ class ReferencedBySelectionProxyDb(ProxyDbBase):
self.process_attributes(event)
place_handle = event.get_place_handle()
try:
if place_handle:
place = self.db.get_place_from_handle(place_handle)
if place:
self.process_place(place)
except AttributeError:
import logging
logging.warning('Event:%s; Handle:%s' % (event, event.handle))
def process_place(self, place):
"""
@ -402,6 +399,7 @@ class ReferencedBySelectionProxyDb(ProxyDbBase):
self.process_family(fam)
place_handle = lds_ord.get_place_handle()
if place_handle:
place = self.db.get_place_from_handle(place_handle)
if place:
self.process_place(place)