From c695f4b2c3629fc42ea4d85b75a945f3321239a6 Mon Sep 17 00:00:00 2001 From: Gary Burton Date: Sun, 1 Feb 2009 12:35:47 +0000 Subject: [PATCH] Treat RESI tokens as events and not import them as Gramps addresses as per advice on the wiki concerning using residence events to record addresses. Bug #2651 svn: r11788 --- src/GrampsDbUtils/_GedcomParse.py | 126 ----------------------------- src/GrampsDbUtils/_GedcomTokens.py | 3 +- 2 files changed, 1 insertion(+), 128 deletions(-) diff --git a/src/GrampsDbUtils/_GedcomParse.py b/src/GrampsDbUtils/_GedcomParse.py index 16afbdb66..d6d49b2ff 100644 --- a/src/GrampsDbUtils/_GedcomParse.py +++ b/src/GrampsDbUtils/_GedcomParse.py @@ -329,7 +329,6 @@ class GedcomParser(UpdateCallback): TOKEN_RELI : self.__person_reli, TOKEN_ADOP : self.__person_adop, TOKEN_DEAT : self.__person_deat, - TOKEN_RESI : self.__person_resi, # +1 <> {0:M} # +1 AFN {0:1} TOKEN_ATTR : self.__person_std_attr, @@ -500,22 +499,6 @@ class GedcomParser(UpdateCallback): TOKEN_STAT : self.__ignore, } - self.resi_parse_tbl = { - TOKEN_DATE : self.__person_resi_date, - TOKEN_ADDR : self.__person_resi_addr, - TOKEN_SOUR : self.__person_resi_sour, - TOKEN_PLAC : self.__person_resi_plac, - TOKEN_PHON : self.__person_resi_phon, - TOKEN_NOTE : self.__person_resi_note, - TOKEN_RNOTE : self.__person_resi_note, - TOKEN_IGNORE : self.__ignore, - TOKEN_CAUS : self.__ignore, - TOKEN_STAT : self.__ignore, - TOKEN_TEMP : self.__ignore, - TOKEN_OBJE : self.__ignore, - TOKEN_TYPE : self.__ignore, - } - self.person_fact_parse_tbl = { TOKEN_TYPE : self.__person_fact_type, } @@ -1816,115 +1799,6 @@ class GedcomParser(UpdateCallback): sref = self.handle_source(line, state.level) state.name.add_source_reference(sref) - def __person_resi(self, line, state): - """ - The RESI tag follows the EVENT_DETAIL structure, which is: - - n TYPE {0:1} - n DATE {0:1} - n <> {0:1} - n <> {0:1} - n AGE {0:1} - n AGNC {0:1} - n CAUS {0:1} - n <> {0:M} - n <> {0:M} - n <> {0:M} - - Currently, the TYPE, AGE, CAUSE, STAT, and other tags which - do not apply to an address are ignored. - - @param line: The current line in GedLine format - @type line: GedLine - @param state: The current state - @type state: CurrentState - """ - - addr = gen.lib.Address() - - sub_state = GedcomUtils.CurrentState() - sub_state.person = state.person - sub_state.level = state.level+1 - sub_state.addr = addr - sub_state.person.add_address(addr) - - self.__parse_level(sub_state, self.resi_parse_tbl, self.__undefined) - - def __person_resi_date(self, line, state): - """ - Set the date on the address associated with and Address. - - @param line: The current line in GedLine format - @type line: GedLine - @param state: The current state - @type state: CurrentState - """ - state.addr.set_date_object(line.data) - - def __person_resi_addr(self, line, state): - """ - Parses the ADDR line of a RESI tag - - @param line: The current line in GedLine format - @type line: GedLine - @param state: The current state - @type state: CurrentState - """ - state.addr.set_street(line.data) - - sub_state = GedcomUtils.CurrentState() - sub_state.addr = state.addr - sub_state.level = state.level + 1 - sub_state.person = state.person - self.__parse_level(sub_state, self.parse_addr_tbl, self.__ignore) - - def __person_resi_sour(self, line, state): - """ - Parses the source connected to a RESI tag - - @param line: The current line in GedLine format - @type line: GedLine - @param state: The current state - @type state: CurrentState - """ - state.addr.add_source_reference(self.handle_source(line, state.level)) - - def __person_resi_plac(self, line, state): - """ - Parses the PLAC tag connected to a RESI tag - - @param line: The current line in GedLine format - @type line: GedLine - @param state: The current state - @type state: CurrentState - """ - state.addr.set_street(line.data) - self.__parse_level(state, self.parse_addr_tbl, self.__ignore) - - def __person_resi_phon(self, line, state): - """ - Parses the source connected to a PHON tag - - @param line: The current line in GedLine format - @type line: GedLine - @param state: The current state - @type state: CurrentState - """ - if state.addr.get_street() == "": - state.addr.set_street("Unknown") - state.addr.set_phone(line.data) - - def __person_resi_note(self, line, state): - """ - Parses the NOTE connected to a RESI tag - - @param line: The current line in GedLine format - @type line: GedLine - @param state: The current state - @type state: CurrentState - """ - self.__parse_note(line, state.addr, state.level+1) - def __ignore(self, line, state): """ Ignores an unsupported tag diff --git a/src/GrampsDbUtils/_GedcomTokens.py b/src/GrampsDbUtils/_GedcomTokens.py index 46299feb4..be3b498d5 100644 --- a/src/GrampsDbUtils/_GedcomTokens.py +++ b/src/GrampsDbUtils/_GedcomTokens.py @@ -206,8 +206,7 @@ TOKENS = { "QUALITY_OF_DATA": TOKEN_QUAY, "REFN" : TOKEN_REFN, "REFERENCE" : TOKEN_REFN, "RELI" : TOKEN_RELI, "RELIGION" : TOKEN_RELI, "REPO" : TOKEN_REPO, - "REPOSITORY" : TOKEN_REPO, "RESI" : TOKEN_RESI, - "RESIDENCE" : TOKEN_RESI, "RFN" : TOKEN_RFN, + "REPOSITORY" : TOKEN_REPO, "RFN" : TOKEN_RFN, "RIN" : TOKEN_RIN, "_SCHEMA" : TOKEN__SCHEMA, "SEX" : TOKEN_SEX, "SCHEMA" : TOKEN__SCHEMA, "SLGC" : TOKEN_SLGC, "SLGS" : TOKEN_SLGS,