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
This commit is contained in:
Doug Blank 2009-02-01 21:34:07 +00:00
parent 662dbc94f6
commit bccc1be7f2
2 changed files with 28 additions and 4 deletions

View File

@ -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<dateval val="%s"%s%s%s/>\n'
% (sp,date_str,mode_str,qual_str,calstr))
self.g.write('%s<dateval val="%s"%s%s%s%s%s/>\n'
% (sp, date_str, mode_str, qual_str,
calstr, dualdated_str, newyear_str))
else:
self.g.write('%s<datestr val="%s"/>\n'
%(sp,self.fix(date.get_text())))

View File

@ -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: