From f740ba4cf0707c0d92703fb30327ca1cae831c49 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Wed, 29 Jun 2005 20:24:42 +0000 Subject: [PATCH] * src/GrampsBSDDB.py: provide an upgrade task to rebuild gender stats svn: r4891 --- gramps2/ChangeLog | 1 + gramps2/src/GrampsBSDDB.py | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 1f370c386..3d6bfac79 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,4 +1,5 @@ 2005-06-29 Don Allingham + * src/GrampsBSDDB.py: provide an upgrade task to rebuild gender stats * src/GrampsDbBase.py: move gender stats handling to the commit_person task, instead of trying to handle it in the Person() class * src/RelLib.py: removal of genderstats handling diff --git a/gramps2/src/GrampsBSDDB.py b/gramps2/src/GrampsBSDDB.py index 4f49ba817..fbc47caba 100644 --- a/gramps2/src/GrampsBSDDB.py +++ b/gramps2/src/GrampsBSDDB.py @@ -43,7 +43,7 @@ from bsddb import dbshelve, db from RelLib import * from GrampsDbBase import * -_DBVERSION = 6 +_DBVERSION = 7 def find_surname(key,data): return str(data[3].get_surname()) @@ -421,6 +421,8 @@ class GrampsBSDDB(GrampsDbBase): self.upgrade_5() if version < 6: self.upgrade_6() + if version < 7: + self.upgrade_7() self.metadata['version'] = _DBVERSION print 'Successfully finished all upgrades' @@ -737,3 +739,16 @@ class GrampsBSDDB(GrampsDbBase): if val[1] != 6: order.append(val) self.set_media_column_order(order) + + def upgrade_7(self): + print "Upgrading to DB version 7" + + self.genderStats = GenderStats() + cursor = self.get_person_cursor() + data = cursor.first() + while data: + handle,val = data + p = Person(val) + self.genderStats.count_person(p,self) + data = cursor.next() + cursor.close()