From bccc1be7f28975621b5b6b386255fd4297abc2c1 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Sun, 1 Feb 2009 21:34:07 +0000 Subject: [PATCH] Bug #2625: Need to bring XML DTD, import, export to use changes in trunk. These changes add support for dualdated and newyear dates. svn: r11793 --- src/plugins/ExportXml.py | 17 +++++++++++++++-- src/plugins/ImportXml.py | 15 +++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/plugins/ExportXml.py b/src/plugins/ExportXml.py index f28fd47e0..d313d486d 100644 --- a/src/plugins/ExportXml.py +++ b/src/plugins/ExportXml.py @@ -799,6 +799,18 @@ class GrampsDbXmlWriter(UpdateCallback): else: qual_str = "" + dualdated = date.get_slash() + if dualdated: + dualdated_str = ' dualdated="1"' + else: + dualdated_str = '' + + newyear = date.get_new_year() + if newyear != gen.lib.Date.NEWYEAR_JAN1: + newyear_str = ' newyear="%d"' % newyear + else: + newyear_str = '' + mode = date.get_modifier() if date.is_compound(): @@ -826,8 +838,9 @@ class GrampsDbXmlWriter(UpdateCallback): else: mode_str = "" - self.g.write('%s\n' - % (sp,date_str,mode_str,qual_str,calstr)) + self.g.write('%s\n' + % (sp, date_str, mode_str, qual_str, + calstr, dualdated_str, newyear_str)) else: self.g.write('%s\n' %(sp,self.fix(date.get_text()))) diff --git a/src/plugins/ImportXml.py b/src/plugins/ImportXml.py index ca2ef11c1..ff698903a 100644 --- a/src/plugins/ImportXml.py +++ b/src/plugins/ImportXml.py @@ -1817,8 +1817,19 @@ class GrampsParser(UpdateCallback): qual = gen.lib.Date.QUAL_NONE else: qual = gen.lib.Date.QUAL_NONE - - date_value.set(qual, mod, cal, (day, month, year, False)) + + dualdated = False + if 'dualdated' in attrs: + val = attrs['dualdated'] + if val == "1": + dualdated = True + + newyear = gen.lib.Date.NEWYEAR_JAN1 + if 'newyear' in attrs: + newyear = int(attrs['newyear']) + + date_value.set(qual, mod, cal, (day, month, year, dualdated), + newyear=newyear) def start_datestr(self, attrs): if self.source_ref: