Removed some try/excepts (they're expensive and can make debugging hard) and fix for bug 0002114

svn: r10640
This commit is contained in:
Doug Blank 2008-04-26 20:33:25 +00:00
parent 09246035b3
commit 26779bd6ac

View File

@ -75,25 +75,25 @@ _family_cache = {}
_event_cache = {} _event_cache = {}
def find_event(db, handle): def find_event(db, handle):
try: if handle in _event_cache:
obj = _event_cache[handle] obj = _event_cache[handle]
except KeyError: else:
obj = db.get_event_from_handle(handle) obj = db.get_event_from_handle(handle)
_event_cache[handle] = obj _event_cache[handle] = obj
return obj return obj
def find_person(db, handle): def find_person(db, handle):
try: if handle in _person_cache:
obj = _person_cache[handle] obj = _person_cache[handle]
except KeyError: else:
obj = db.get_person_from_handle(handle) obj = db.get_person_from_handle(handle)
_person_cache[handle] = obj _person_cache[handle] = obj
return obj return obj
def find_family(db, handle): def find_family(db, handle):
try: if handle in _family_cache:
obj = _family_cache[handle] obj = _family_cache[handle]
except KeyError: else:
obj = db.get_family_from_handle(handle) obj = db.get_family_from_handle(handle)
_family_cache[handle] = obj _family_cache[handle] = obj
return obj return obj
@ -195,6 +195,7 @@ def get_n_children(db,person):
n = 0 n = 0
for family_handle in person.get_family_handle_list(): for family_handle in person.get_family_handle_list():
family = find_family(db,family_handle) family = find_family(db,family_handle)
if family:
n += len(family.get_child_ref_list()) n += len(family.get_child_ref_list())
return n return n
@ -584,9 +585,9 @@ class VerifyResults(ManagedWindow):
return False return False
def get_marking(self, handle,rule_id): def get_marking(self, handle,rule_id):
try: if handle in self.ignores:
return (rule_id in self.ignores[handle]) return (rule_id in self.ignores[handle])
except KeyError: else:
return False return False
def get_new_marking(self): def get_new_marking(self):