From d3c03dc11a2b071f1ddffa3e79f50902dfe7ded5 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Thu, 31 May 2012 14:08:00 +0000 Subject: [PATCH] implement has_object() methods in django db svn: r19724 --- src/webapp/dbdjango.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/webapp/dbdjango.py b/src/webapp/dbdjango.py index 4dcefb787..ed296a5df 100644 --- a/src/webapp/dbdjango.py +++ b/src/webapp/dbdjango.py @@ -99,6 +99,8 @@ class DbDjango(DbWriteBase, DbReadBase): def __init__(self): DbReadBase.__init__(self) DbWriteBase.__init__(self) + # skip GEDCOM cross-ref check for now: + self.set_feature("skip-check-xref", True) self.dji = DjangoInterface() self.readonly = False self.db_is_open = True @@ -768,33 +770,53 @@ class DbDjango(DbWriteBase, DbReadBase): return self.dji.Person.filter(gramps_id=gramps_id).count() > 0 def has_person_handle(self, handle): + if handle in self.import_cache: + return True return self.dji.Person.filter(handle=handle).count() == 1 def has_family_handle(self, handle): + if handle in self.import_cache: + return True return self.dji.Family.filter(handle=handle).count() == 1 def has_citation_handle(self, handle): + if handle in self.import_cache: + return True return self.dji.Citation.filter(handle=handle).count() == 1 def has_source_handle(self, handle): + if handle in self.import_cache: + return True return self.dji.Source.filter(handle=handle).count() == 1 def has_repository_handle(self, handle): + if handle in self.import_cache: + return True return self.dji.Repository.filter(handle=handle).count() == 1 def has_note_handle(self, handle): + if handle in self.import_cache: + return True return self.dji.Note.filter(handle=handle).count() == 1 def has_place_handle(self, handle): + if handle in self.import_cache: + return True return self.dji.Place.filter(handle=handle).count() == 1 def has_event_handle(self, handle): + if handle in self.import_cache: + return True return self.dji.Event.filter(handle=handle).count() == 1 def has_tag_handle(self, handle): + if handle in self.import_cache: + return True return self.dji.Tag.filter(handle=handle).count() == 1 def has_object_handle(self, handle): + if handle in self.import_cache: + return True return self.dji.Media.filter(handle=handle).count() == 1 def has_name_group_key(self, key):