From 6c5bfa69e3c6d440f21c6308f408424ff7e6a794 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Thu, 5 Oct 2006 23:01:43 +0000 Subject: [PATCH] * src/GrampsDb/_GrampsBSDDB.py (gramps_upgrade_11): Upgrade addresses in repositories. svn: r7356 --- gramps2/ChangeLog | 2 ++ gramps2/src/GrampsDb/_GrampsBSDDB.py | 27 +++++++++++++++++++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index c12572061..7b9272462 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,4 +1,6 @@ 2006-10-05 Alex Roitman + * src/GrampsDb/_GrampsBSDDB.py (gramps_upgrade_11): Upgrade + addresses in repositories. * src/Config/_GrampsConfigKeys.py: Regenerate file (proper type for transactions key). diff --git a/gramps2/src/GrampsDb/_GrampsBSDDB.py b/gramps2/src/GrampsDb/_GrampsBSDDB.py index 3b2da5003..e43db7cc0 100644 --- a/gramps2/src/GrampsDb/_GrampsBSDDB.py +++ b/gramps2/src/GrampsDb/_GrampsBSDDB.py @@ -2035,14 +2035,15 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback): table_flags) - # This upgrade adds attribute lists to Event and EventRef objects - length = len(self.person_map) + len(self.place_map) + # This upgrade modifies address + length = len(self.person_map) + len(self.place_map) \ + + len(self.repository_map) self.set_total(length) # so starting (batch) transaction here. trans = self.transaction_begin("",True) - # Personal event references + # Personal addresses for handle in self.person_map.keys(): info = self.person_map[handle] @@ -2061,7 +2062,25 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback): self.commit_person(person,trans) self.update() - # Personal event references + # Repositories + for handle in self.repository_map.keys(): + info = self.repository_map[handle] + + new_address_list = [] + for addr in info[5]: + loc = ( addr[9], addr[4], u'', addr[5], addr[6], + addr[7], addr[8]) + addr = (addr[0],addr[1],addr[2],addr[3], loc) + new_address_list.append(addr) + + new_info = info[0:5] + (new_address_list,) + info[6:] + + repository = Repository() + repository.unserialize(new_info) + self.commit_repository(repository,trans) + self.update() + + # Places for handle in self.place_map.keys(): info = self.place_map[handle]