* src/GrampsBSDDB.py: provide an upgrade task to rebuild gender stats

svn: r4891
This commit is contained in:
Don Allingham 2005-06-29 20:24:42 +00:00
parent f1b13b49c5
commit f740ba4cf0
2 changed files with 17 additions and 1 deletions

View File

@ -1,4 +1,5 @@
2005-06-29 Don Allingham <don@gramps-project.org>
* 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

View File

@ -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()