From c1be620f909accd02dab053af3c57dcd4ab81109 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sat, 21 Apr 2007 04:30:13 +0000 Subject: [PATCH] 2007-04-20 Don Allingham * src/GrampsDb/_ReadGedcom.py: fix calendar parsing * src/GrampsDb/_WriteGedcom.py: fix calendar generation svn: r8412 --- gramps2/ChangeLog | 4 ++++ gramps2/src/GrampsDb/_ReadGedcom.py | 11 +++++++---- gramps2/src/GrampsDb/_WriteGedcom.py | 6 +++--- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index f6f16f985..ecf2d0f39 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,7 @@ +2007-04-20 Don Allingham + * src/GrampsDb/_ReadGedcom.py: fix calendar parsing + * src/GrampsDb/_WriteGedcom.py: fix calendar generation + 2007-04-20 Alex Roitman * src/plugins/Checkpoint.py (Checkpoint.rcs): Remove debugging output; Work out retrieval. diff --git a/gramps2/src/GrampsDb/_ReadGedcom.py b/gramps2/src/GrampsDb/_ReadGedcom.py index 38af7b55f..4356b5e1a 100644 --- a/gramps2/src/GrampsDb/_ReadGedcom.py +++ b/gramps2/src/GrampsDb/_ReadGedcom.py @@ -183,9 +183,9 @@ intRE = re.compile(r"\s*(\d+)\s*$") nameRegexp = re.compile(r"/?([^/]*)(/([^/]*)(/([^/]*))?)?") snameRegexp = re.compile(r"/([^/]*)/([^/]*)") modRegexp = re.compile(r"\s*(EST|CAL)\s+(.*)$") -calRegexp = re.compile(r"\s*(ABT|BEF|AFT)?\s*@#D([^@]+)@\s*(.*)$") -rangeRegexp = re.compile(r"\s*BET\s+@#D([^@]+)@\s*(.*)\s+AND\s+@#D([^@]+)@\s*(.*)$") -spanRegexp = re.compile(r"\s*FROM\s+@#D([^@]+)@\s*(.*)\s+TO\s+@#D([^@]+)@\s*(.*)$") +calRegexp = re.compile(r"\s*(ABT|BEF|AFT)?\s*@#D?([^@]+)@\s*(.*)$") +rangeRegexp = re.compile(r"\s*BET\s+@#D?([^@]+)@\s*(.*)\s+AND\s+@#D?([^@]+)@\s*(.*)$") +spanRegexp = re.compile(r"\s*FROM\s+@#D?([^@]+)@\s*(.*)\s+TO\s+@#D?([^@]+)@\s*(.*)$") intRegexp = re.compile(r"\s*INT\s+([^(]+)\((.*)\)$") #------------------------------------------------------------------------- @@ -2456,7 +2456,10 @@ class GedcomParser(UpdateCallback): match = calRegexp.match(text) if match: (abt,cal,data) = match.groups() - dateobj = self.dp.parse("%s %s" % (abt, data)) + if abt: + dateobj = self.dp.parse("%s %s" % (abt, data)) + else: + dateobj = self.dp.parse(data) if cal == "FRENCH R": dateobj.set_calendar(RelLib.Date.CAL_FRENCH) elif cal == "JULIAN": diff --git a/gramps2/src/GrampsDb/_WriteGedcom.py b/gramps2/src/GrampsDb/_WriteGedcom.py index 06e2299e7..fd5f20c30 100644 --- a/gramps2/src/GrampsDb/_WriteGedcom.py +++ b/gramps2/src/GrampsDb/_WriteGedcom.py @@ -105,9 +105,9 @@ _month = [ "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" ] _calmap = { - RelLib.Date.CAL_HEBREW : (_hmonth, '@#HEBREW@'), - RelLib.Date.CAL_FRENCH : (_fmonth, '@#FRENCH R@'), - RelLib.Date.CAL_JULIAN : (_month, '@#JULIAN@'), + RelLib.Date.CAL_HEBREW : (_hmonth, '@#DHEBREW@'), + RelLib.Date.CAL_FRENCH : (_fmonth, '@#DFRENCH R@'), + RelLib.Date.CAL_JULIAN : (_month, '@#DJULIAN@'), } _caldef = {