From 21c59e9e8fa39ac11aa6afe95260d7215e389f97 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Tue, 21 Aug 2007 04:17:12 +0000 Subject: [PATCH] * src/GrampsDbUtils/_ParseGedcom.py: check for MARR event in std_event, not in family_even * src/RelLib/_FamilyRelType.py: default marriage type to unknown * src/GrampsDbUtils/_WriteGedcom.py: Don't add description to EVEN tag 2007-08-20 Don Allingham svn: r8846 --- ChangeLog | 6 ++++++ src/GrampsDbUtils/_GedcomParse.py | 24 ++++++++++++------------ src/GrampsDbUtils/_WriteGedcom.py | 9 +-------- src/RelLib/_FamilyRelType.py | 2 ++ 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index f79a9cbc4..4ec7420a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,12 @@ 2007-08-20 Jérôme Rapinat * src/Relationship.py: Fix array bounds check. +2007-08-20 Don Allingham + * src/GrampsDbUtils/_ParseGedcom.py: check for MARR event in std_event, + not in family_even + * src/RelLib/_FamilyRelType.py: default marriage type to unknown + * src/GrampsDbUtils/_WriteGedcom.py: Don't add description to EVEN tag + 2007-08-20 Don Allingham * src/ScratchPad.py (ScratchPadSourceRef.__init__): handle the removal of the get_text() function diff --git a/src/GrampsDbUtils/_GedcomParse.py b/src/GrampsDbUtils/_GedcomParse.py index 29d02c0d3..ab29863f6 100644 --- a/src/GrampsDbUtils/_GedcomParse.py +++ b/src/GrampsDbUtils/_GedcomParse.py @@ -2568,6 +2568,18 @@ class GedcomParser(UpdateCallback): self.__parse_level(sub_state, self.event_parse_tbl, self.__undefined) + if int(event.get_type()) == RelLib.EventType.MARRIAGE: + descr = event.get_description() + print "EVENT", str(event.get_type()), descr + if descr == "Civil Union": + state.family.type.set(RelLib.FamilyRelType.CIVIL_UNION) + event.set_description('') + elif descr == "Unmarried": + state.family.type.set(RelLib.FamilyRelType.UNMARRIED) + event.set_description('') + else: + state.family.type.set(RelLib.FamilyRelType.MARRIED) + family_event_name(event, state.family, self.dbase) self.dbase.commit_event(event, self.trans) event_ref.ref = event.handle @@ -2600,18 +2612,6 @@ class GedcomParser(UpdateCallback): self.__parse_level(sub_state, self.event_parse_tbl, self.__undefined) - if int(event.get_type()) == RelLib.EventType.MARRIAGE: - - descr = event.get_description() - if descr == "Civil Union": - state.family.type.set(RelLib.FamilyRelType.CIVIL_UNION) - event.set_description('') - elif descr == "Unmarried": - state.family.type.set(RelLib.FamilyRelType.UNMARRIED) - event.set_description('') - else: - state.family.type.set(RelLib.FamilyRelType.MARRIED) - family_event_name(event, state.family, self.dbase) self.dbase.commit_event(event, self.trans) diff --git a/src/GrampsDbUtils/_WriteGedcom.py b/src/GrampsDbUtils/_WriteGedcom.py index 5e5f3f7a3..0e2a51a81 100644 --- a/src/GrampsDbUtils/_WriteGedcom.py +++ b/src/GrampsDbUtils/_WriteGedcom.py @@ -692,14 +692,7 @@ class GedcomWriter(UpdateCallback): if event.get_description().strip(): self.__writeln(2, 'TYPE', event.get_description()) else: - # Actually, it is against the spec to put anything - # after EVEN on the same line, possibly an option is - # needed on how to handle this - - if event.get_description().strip() != "": - self.__writeln(1, 'EVEN', event.get_description()) - else: - self.__writeln(1, 'EVEN') + self.__writeln(1, 'EVEN') if val.strip(): self.__writeln(2, 'TYPE', val) else: diff --git a/src/RelLib/_FamilyRelType.py b/src/RelLib/_FamilyRelType.py index ee42cadd3..ba477e905 100644 --- a/src/RelLib/_FamilyRelType.py +++ b/src/RelLib/_FamilyRelType.py @@ -53,4 +53,6 @@ class FamilyRelType(GrampsType): _E2IMAP = init_map(_DATAMAP, 2, 0) def __init__(self, value=None): + if value == None: + value = self.UNKNOWN GrampsType.__init__(self, value)