More empty handle checks in proxies

This commit is contained in:
Nick Hall 2015-12-12 21:51:25 +00:00
parent 4e1b72ab60
commit cff726a4bb
2 changed files with 13 additions and 9 deletions

View File

@ -146,13 +146,15 @@ class LivingProxyDb(ProxyDbBase):
def get_default_person(self):
"""returns the default Person of the database"""
person_handle = self.db.get_default_handle()
return self.get_person_from_handle(person_handle)
if person_handle:
return self.get_person_from_handle(person_handle)
return None
def get_default_handle(self):
"""returns the default Person of the database"""
person_handle = self.db.get_default_handle()
if self.get_person_from_handle(person_handle):
return person_handle
if person_handle and self.get_person_from_handle(person_handle):
return person_handle
return None
def has_person_handle(self, handle):

View File

@ -312,9 +312,10 @@ class PrivateProxyDb(ProxyDbBase):
def get_default_handle(self):
"""returns the default Person of the database"""
handle = self.db.get_default_handle()
person = self.db.get_person_from_handle(handle)
if person and not person.get_privacy():
return handle
if handle:
person = self.db.get_person_from_handle(handle)
if person and not person.get_privacy():
return handle
return None
def has_person_handle(self, handle):
@ -640,9 +641,10 @@ def sanitize_lds_ord(db, lds_ord):
new_lds_ord.set_temple(lds_ord.get_temple())
fam_handle = lds_ord.get_family_handle()
fam = db.get_family_from_handle(fam_handle)
if fam and not fam.get_privacy():
new_lds_ord.set_family_handle(fam_handle)
if fam_handle:
fam = db.get_family_from_handle(fam_handle)
if fam and not fam.get_privacy():
new_lds_ord.set_family_handle(fam_handle)
new_lds_ord.set_date_object(lds_ord.get_date_object())