From 2ac01bfcc7324f9b594dda4d2050eb269a31ece3 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Sun, 6 Apr 2008 12:20:33 +0000 Subject: [PATCH] Undo db update... missed many dates; reworking upgrade svn: r10499 --- src/gen/db/dbdir.py | 26 +++----------------------- src/gen/lib/date.py | 25 +++++++------------------ 2 files changed, 10 insertions(+), 41 deletions(-) diff --git a/src/gen/db/dbdir.py b/src/gen/db/dbdir.py index e02df6e1f..832eed19d 100644 --- a/src/gen/db/dbdir.py +++ b/src/gen/db/dbdir.py @@ -499,7 +499,7 @@ class GrampsDBDir(GrampsDbBase, UpdateCallback): if callback: callback(25) - self.metadata = self.__open_table(self.full_name, META) + self.metadata = self.__open_table(self.full_name, META) # If we cannot work with this DB version, # it makes no sense to go further @@ -1712,32 +1712,11 @@ class GrampsDBDir(GrampsDbBase, UpdateCallback): the_txn.commit() self.update() - # modifies dates: adds an integer for newyear code. - length = len(self.event_map) - self.set_total(length) - for handle in self.event_map.keys(): - event = self.event_map[handle] - (junk_handle, gramps_id, the_type, date, description, place, - source_list, note_list, media_list, attribute_list, - change, marker, private) = event - if date != None: - (calendar, modifier, quality, dateval, text, sortval) = date - newyear = 0 - new_date = (calendar, modifier, quality, dateval,text,sortval, - newyear) - new_event = (junk_handle, gramps_id, the_type, new_date, - description, place, source_list, note_list, - media_list, attribute_list, change,marker,private) - the_txn = self.env.txn_begin() - self.event_map.put(str(handle), new_event, txn=the_txn) - the_txn.commit() - self.update() - # Bump up database version. Separate transaction to save metadata. the_txn = self.env.txn_begin() self.metadata.put('version', 14, txn=the_txn) the_txn.commit() - + def write_version(self, name): """Write version number for a newly created DB.""" full_name = os.path.abspath(name) @@ -1774,6 +1753,7 @@ class GrampsDBDir(GrampsDbBase, UpdateCallback): self.metadata.close() self.env.close() + #------------------------------------------------------------------------- # # BdbTransaction diff --git a/src/gen/lib/date.py b/src/gen/lib/date.py index 38c170227..53d6db178 100644 --- a/src/gen/lib/date.py +++ b/src/gen/lib/date.py @@ -80,7 +80,7 @@ class Date: Supports partial dates, compound dates and alternate calendars. """ - MOD_NONE = 0 # CODE + MOD_NONE = 0 MOD_BEFORE = 1 MOD_AFTER = 2 MOD_ABOUT = 3 @@ -88,23 +88,17 @@ class Date: MOD_SPAN = 5 MOD_TEXTONLY = 6 - QUAL_NONE = 0 # BITWISE - QUAL_ESTIMATED = 1 - QUAL_CALCULATED = 2 - QUAL_INTERPRETED = 4 + QUAL_NONE = 0 + QUAL_ESTIMATED = 1 + QUAL_CALCULATED = 2 - CAL_GREGORIAN = 0 # CODE + CAL_GREGORIAN = 0 CAL_JULIAN = 1 CAL_HEBREW = 2 CAL_FRENCH = 3 CAL_PERSIAN = 4 CAL_ISLAMIC = 5 - NEWYEAR_JAN1 = 0 # CODE - NEWYEAR_MAR1 = 1 - NEWYEAR_MAR25 = 2 - NEWYEAR_SEP1 = 3 - EMPTY = (0, 0, 0, False) _POS_DAY = 0 @@ -187,7 +181,6 @@ class Date: self.dateval = Date.EMPTY self.text = u"" self.sortval = 0 - self.newyear = 0 self.set_yr_mon_day(*source) elif type(source) == str: if (calendar != None or @@ -203,7 +196,6 @@ class Date: self.dateval = source.dateval self.text = source.text self.sortval = source.sortval - self.newyear = source.newyear elif source: self.calendar = source.calendar self.modifier = source.modifier @@ -211,7 +203,6 @@ class Date: self.dateval = source.dateval self.text = source.text self.sortval = source.sortval - self.newyear = source.newyear else: self.calendar = Date.CAL_GREGORIAN self.modifier = Date.MOD_NONE @@ -219,7 +210,6 @@ class Date: self.dateval = Date.EMPTY self.text = u"" self.sortval = 0 - self.newyear = Date.NEWYEAR_JAN1 def serialize(self, no_text_date=False): """ @@ -231,14 +221,14 @@ class Date: text = self.text return (self.calendar, self.modifier, self.quality, - self.dateval, text, self.sortval, self.newyear) + self.dateval, text, self.sortval) def unserialize(self, data): """ Load from the format created by serialize. """ (self.calendar, self.modifier, self.quality, - self.dateval, self.text, self.sortval, self.newyear) = data + self.dateval, self.text, self.sortval) = data return self def copy(self, source): @@ -252,7 +242,6 @@ class Date: self.dateval = source.dateval self.text = source.text self.sortval = source.sortval - self.newyear = source.newyear def __cmp__(self, other): """