* src/GrampsBSDDB.py (upgrade_8): Insert check for event_list.

* src/plugins/Check.py (check_events): Add checks for family
events; Replace garbage event_list with empty list for both
types.


svn: r5067
This commit is contained in:
Alex Roitman 2005-08-12 18:35:30 +00:00
parent 234baa9682
commit 324930e165
3 changed files with 51 additions and 12 deletions

View File

@ -1,3 +1,9 @@
2005-08-12 Alex Roitman <shura@gramps-project.org>
* src/GrampsBSDDB.py (upgrade_8): Insert check for event_list.
* src/plugins/Check.py (check_events): Add checks for family
events; Replace garbage event_list with empty list for both
types.
2005-08-12 Jiri Pejchal <jiri.pejchal@gmail.com>
* src/po/cs.po: Updated Czech translation.

View File

@ -847,9 +847,11 @@ class GrampsBSDDB(GrampsDbBase):
while data:
handle,val = data
handle_list = val[8]
for handle in handle_list:
event = self.get_event_from_handle(handle)
self.individual_event_names.add(event.name)
if type(handle_list) == list:
# Check to prevent crash on corrupted data (event_list=None)
for handle in handle_list:
event = self.get_event_from_handle(handle)
self.individual_event_names.add(event.name)
data = cursor.next()
cursor.close()
@ -858,9 +860,10 @@ class GrampsBSDDB(GrampsDbBase):
while data:
handle,val = data
handle_list = val[6]
for handle in handle_list:
event = self.get_event_from_handle(handle)
self.family_event_names.add(event.name)
if type(handle_list) == list:
# Check to prevent crash on corrupted data (event_list=None)
for handle in handle_list:
event = self.get_event_from_handle(handle)
self.family_event_names.add(event.name)
data = cursor.next()
cursor.close()

View File

@ -431,7 +431,8 @@ class CheckIntegrity:
def check_events(self):
self.progress.set_pass(_('Looking for event problems'),
self.db.get_number_of_people())
self.db.get_number_of_people()
+self.db.get_number_of_families())
for key in self.db.get_person_handles(sort_handles=False):
self.progress.step()
@ -441,7 +442,8 @@ class CheckIntegrity:
if birth_handle:
birth = self.db.get_event_from_handle(birth_handle)
if not birth:
# The birth event referenced by the birth handle does not exist in the database
# The birth event referenced by the birth handle
# does not exist in the database
person.set_birth_handle("")
self.db.commit_person(person,self.trans)
self.invalid_events.append(key)
@ -455,7 +457,8 @@ class CheckIntegrity:
if death_handle:
death = self.db.get_event_from_handle(death_handle)
if not death:
# The death event referenced by the death handle does not exist in the database
# The death event referenced by the death handle
# does not exist in the database
person.set_death_handle("")
self.db.commit_person(person,self.trans)
self.invalid_events.append(key)
@ -465,15 +468,42 @@ class CheckIntegrity:
death.set_name("Death");
self.db.commit_event(death,self.trans)
self.invalid_death_events.append(key)
if person.get_event_list():
for event_handle in person.get_event_list():
event = self.db.get_event_from_handle(event_handle)
if not event:
# The event referenced by the person does not exist in the database
# The event referenced by the person
# does not exist in the database
#TODO: There is no better way?
person.set_event_list( person.get_event_list().remove(event_handle))
person.set_event_list(
person.get_event_list().remove(event_handle))
self.db.commit_person(person,self.trans)
self.invalid_events.append(key)
elif type(person.get_event_list()) != list:
# event_list is None or other garbage
person.set_event_list([])
self.db.commit_person(person,self.trans)
self.invalid_events.append(key)
for key in self.db.get_family_handles():
self.progress.step()
family = self.db.get_family_from_handle(key)
if family.get_event_list():
for event_handle in family.get_event_list():
event = self.db.get_event_from_handle(event_handle)
if not event:
# The event referenced by the family
# does not exist in the database
family.set_event_list(
family.get_event_list().remove(event_handle))
self.db.commit_family(family,self.trans)
self.invalid_events.append(key)
elif type(family.get_event_list()) != list:
# event_list is None or other garbage
family.set_event_list([])
self.db.commit_family(family,self.trans)
self.invalid_events.append(key)
def check_place_references(self):
elist = self.db.get_event_handles()