fix #1418 ASSO in/out errors

svn: r9452
This commit is contained in:
James G Sack 2007-12-06 22:20:26 +00:00
parent bd63b3db14
commit 1ecf25c776
3 changed files with 10 additions and 20 deletions

View File

@ -1,3 +1,10 @@
2007-12-06 Jim Sack <jgsack@san.rr.com>
* src/GrampsDbUtils/_GedcomParse.py : #1418 fix read ASSO
* src/GrampsDbUtils/_WriteGedcom.py : #1418 fix write ASSO
read was looking for TYPE, write was emitting TYPE, but
TYPE evidently was only part of a draft (or earlier) spec
Current spec allows ASSO to link only to INDI
2007-12-06 Douglas S.Blank <dblank@cs.brynmawr.edu>
* src/plugins/CalculateEstimatedDates.py: pass in handle to link
* src/PluginUtils/_PluginWindows.py: New clickable text tests

View File

@ -553,7 +553,6 @@ class GedcomParser(UpdateCallback):
}
self.asso_parse_tbl = {
TOKEN_TYPE : self.__person_asso_type,
TOKEN_RELA : self.__person_asso_rela,
TOKEN_SOUR : self.__person_asso_sour,
TOKEN_NOTE : self.__person_asso_note,
@ -2291,13 +2290,12 @@ class GedcomParser(UpdateCallback):
And the the sub tags are:
ASSOCIATION_STRUCTURE:=
+1 TYPE <RECORD_TYPE> {1:1}
+1 RELA <RELATION_IS_DESCRIPTOR> {1:1}
+1 <<NOTE_STRUCTURE>> {0:M}
+1 <<SOURCE_CITATION>> {0:M}
GRAMPS only supports ASSO records to people, so if the TYPE is
something other than INDI, the record is ignored.
The Gedcom spec notes that the ASSOCIATION_STRUCTURE
can only link to an INDIVIDUAL_RECORD
@param line: The current line in GedLine format
@type line: GedLine
@ -2322,20 +2320,6 @@ class GedcomParser(UpdateCallback):
if not sub_state.ignore:
state.person.add_person_ref(sub_state.ref)
def __person_asso_type(self, line, state):
"""
Parses the INDI.ASSO.TYPE tag. GRAMPS only supports the ASSO tag when
the tag represents an INDI. So if the data is not INDI, we set the
ignore flag, so that we ignore the record.
@param line: The current line in GedLine format
@type line: GedLine
@param state: The current state
@type state: CurrentState
"""
if line.data != "INDI":
state.ignore = True
def __person_asso_rela(self, line, state):
"""
Parses the INDI.ASSO.RELA tag.

View File

@ -537,7 +537,6 @@ class GedcomWriter(BasicUtils.UpdateCallback):
def __assoc(self, person, level):
"""
n ASSO @<XREF:INDI>@ {0:M}
+1 TYPE <RECORD_TYPE> {1:1}
+1 RELA <RELATION_IS_DESCRIPTOR> {1:1}
+1 <<NOTE_STRUCTURE>> {0:M}
+1 <<SOURCE_CITATION>> {0:M}
@ -545,7 +544,7 @@ class GedcomWriter(BasicUtils.UpdateCallback):
for ref in person.get_person_ref_list():
person = self.dbase.get_person_from_handle(ref.ref)
self.__writeln(level, "ASSO", "@%s@" % person.get_gramps_id())
self.__writeln(level+1, "TYPE", ref.get_relation())
self.__writeln(level+1, "RELA", ref.get_relation())
self.__note_references(ref.get_note_list(), level+1)
self.__source_references(ref.get_source_references(), level+1)