From 931c343815b11c74537a79a4afda310fce8ef12a Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Fri, 5 May 2006 21:25:48 +0000 Subject: [PATCH] * src/GrampsDb/_GrampsBSDDB.py (gramps_upgrade_9): Add nickname upgrade. svn: r6556 --- ChangeLog | 2 ++ src/GrampsDb/_GrampsBSDDB.py | 17 ++++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index b28fe18af..0c046f321 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,8 @@ 2006-05-05 Alex Roitman * src/DisplayTabs/_MediaBackRefList.py: Import model. + * src/GrampsDb/_GrampsBSDDB.py (gramps_upgrade_9): Add nickname + upgrade. 2006-05-05 Don Allingham * src/ViewManager.py: Add undo history menu entry diff --git a/src/GrampsDb/_GrampsBSDDB.py b/src/GrampsDb/_GrampsBSDDB.py index 3a0ac4f5d..764681d4b 100644 --- a/src/GrampsDb/_GrampsBSDDB.py +++ b/src/GrampsDb/_GrampsBSDDB.py @@ -1135,11 +1135,11 @@ class GrampsBSDDB(GrampsDbBase): find_referenced_handle,open_flags) self.txn = None - def undo(self): + def undo(self,update_history=True): print "Undoing it" if self.UseTXN: self.txn = self.env.txn_begin() - status = GrampsDbBase.undo(self) + status = GrampsDbBase.undo(self,update_history) if self.UseTXN: if status: self.txn.commit() @@ -1148,11 +1148,11 @@ class GrampsBSDDB(GrampsDbBase): self.txn = None return status - def redo(self): + def redo(self,update_history=True): print "Redoing it" if self.UseTXN: self.txn = self.env.txn_begin() - status = GrampsDbBase.redo(self) + status = GrampsDbBase.redo(self,update_history) if self.UseTXN: if status: self.txn.commit() @@ -1391,7 +1391,7 @@ class GrampsBSDDB(GrampsDbBase): person.handle = handle # Restore data from dbversion 8 (gramps 2.0.9) (junk_handle, person.gramps_id, person.gender, - person.primary_name, person.alternate_names, person.nickname, + person.primary_name, person.alternate_names, nickname, death_handle, birth_handle, event_list, person.family_list, parent_family_list, person.media_list, person.address_list, person.attribute_list, @@ -1446,6 +1446,13 @@ class GrampsBSDDB(GrampsDbBase): for attribute in person.attribute_list: convert_attribute_9(attribute) + # Nickname becomes an attribute + if nickname.strip(): + attr = Attribute() + attr.set_type(AttributeType.NICKNAME) + attr.set_value(nickname) + person.attribute_list.append(attr) + # Cover attributes contained in MediaRefs for media_ref in person.media_list: convert_mediaref_9(media_ref)