diff --git a/gramps/plugins/importer/importprogen.py b/gramps/plugins/importer/importprogen.py index 7fe6df77b..99f7733de 100644 --- a/gramps/plugins/importer/importprogen.py +++ b/gramps/plugins/importer/importprogen.py @@ -33,6 +33,7 @@ from __future__ import print_function, unicode_literals import re import os import struct +import sys #------------------------------------------------------------------------ # @@ -54,7 +55,7 @@ from gramps.gui.utils import ProgressMeter from gramps.gen.lib import (Attribute, AttributeType, ChildRef, Date, Event, EventRef, EventType, Family, FamilyRelType, Name, NameType, Note, NoteType, Person, Place, Source, - Surname, Citation) + Surname, Citation, Location, NameOriginType) from gramps.gen.db import DbTxn class ProgenError(Exception): @@ -85,18 +86,18 @@ def _importData(database, filename, user): return -def _find_from_handle(gramps_id, table): +def _find_from_handle(progen_id, table): """ - Find a handle corresponding to the specified GRAMPS ID. + Find a handle corresponding to the specified Pro-Gen ID. The passed table contains the mapping. If the value is found, we return it, otherwise we create a new handle, store it, and return it. """ - intid = table.get(gramps_id) + intid = table.get(progen_id) if not intid: intid = create_id() - table[gramps_id] = intid + table[progen_id] = intid return intid @@ -115,7 +116,11 @@ def _read_mem(bname): else: fname = bname + '.mem' f = open(fname, "rb") - recfmt = "i28s" + log.debug("The current system is %s-endian" % sys.byteorder) + # The input file comes from [what was originally] a DOS machine so will + # be little-endian, regardless of the 'native' byte order of the host + # system + recfmt = "\d{1,2}) (-|=) (?P\d{1,2}) (-|=) (?P\d{2,4})', re.VERBOSE) __date_pat2 = re.compile(r'(?P\d{1,2}) (-|=) (?P\d{4})', re.VERBOSE) __date_pat3 = re.compile(r'(?P\d{3,4})', re.VERBOSE) - __date_pat4 = re.compile(r'(v|vóór|voor|na|circa|ca|rond|±) (\.|\s)* (?P\d{3,4})', re.VERBOSE) + __date_pat4 = re.compile(r'(v|v√≥√≥r|voor|na|circa|ca|rond|¬±) (\.|\s)* (?P\d{3,4})', re.VERBOSE) __date_pat5 = re.compile(r'(oo|OO) (-|=) (oo|OO) (-|=) (?P\d{2,4})', re.VERBOSE) __date_pat6 = re.compile(r'(?P(%s)) (\.|\s)* (?P\d{3,4})' % '|'.join(list(month_values.keys())), re.VERBOSE | re.IGNORECASE) def __create_date_from_text(self, txt, diag_msg=None): @@ -681,7 +723,7 @@ class ProgenParser(object): m = self.__date_pat4.match(txt) if m: year = int(m.group('year')) - if m.group(1) == 'voor' or m.group(1) == 'v' or m.group(1) == 'vóór': + if m.group(1) == 'voor' or m.group(1) == 'v' or m.group(1) == 'v√≥√≥r': date.set(Date.QUAL_NONE, Date.MOD_BEFORE, Date.CAL_GREGORIAN, (0, 0, year, None)) elif m.group(1) == 'na': date.set(Date.QUAL_NONE, Date.MOD_AFTER, Date.CAL_GREGORIAN, (0, 0, year, None)) @@ -787,13 +829,12 @@ class ProgenParser(object): self.progress.set_pass(_('Importing individuals'), len(self.pers)) for i, rec in enumerate(self.pers): pers_id = i + 1 + log.debug(("Person id %d " % pers_id) + " ".join(("%s" % r) for r in rec)) father = rec[father_ix] mother = rec[mother_ix] if father >= 0 and mother >= 0: recflds = table.convert_record_to_list(rec, self.mems) - first_name = recflds[first_name_ix] - surname_prefix, surname = _split_surname(recflds[surname_ix]) gender = recflds[gender_ix] if gender == 'M': gender = Person.MALE @@ -802,44 +843,52 @@ class ProgenParser(object): else: gender = Person.UNKNOWN - person = self.__find_or_create_person("I%d" % pers_id) - diag_msg = "I%d: %s %s" % (pers_id, first_name.encode('utf-8'), surname.encode('utf-8')) - #log.info(diag_msg) + person = self.__find_or_create_person(pers_id) - patronym = recflds[patron_ix] + first_name = recflds[first_name_ix] + surname_prefix, surname = _split_surname(recflds[surname_ix]) + patronym = recflds[patron_ix] # INDI _PATR + alias = recflds[alias_ix] # INDI NAME _ALIA/INDI NAME COMM + title1 = recflds[title1_ix] # INDI TITL + title2 = recflds[title2_ix] # INDI _TITL2 + title3 = recflds[title3_ix] # INDI _TITL3 + diag_msg = "%s: %s %s" % (person.gramps_id, first_name.encode('utf-8'), surname.encode('utf-8')) + + # process the name/given name name = Name() name.set_type(NameType.BIRTH) - sname = Surname() - sname.set_surname(surname) - name.add_surname(sname) - if surname_prefix: - sname.set_prefix(surname_prefix) name.set_first_name(first_name) if recflds[call_name_ix]: name.set_call_name(recflds[call_name_ix]) + title = [_f for _f in [title1, title2, title3] if _f] + if title: + name.set_title(", ".join(title)) + # process the normal surname + sname = Surname() + sname.set_surname(surname) + if surname_prefix: + sname.set_prefix(surname_prefix) + name.add_surname(sname) + # process the Patronymic if patronym: - #log.warning("Patroniem, %s: '%s'" % (diag_msg, patronym)) - #name.set_patronymic(patronym) - if surname: - # current name is not empty, add one! - sname = Surname() - name.add_surname(sname) - sname.set_surname(patronym) - sname.set_origintype(NameOriginType( - NameOriginType.PATRONYMIC)) - log.warning(_("Patronymic name skipped: '%(patronym)s' (%(msg)s)") % { - 'patronym' : patronym.encode('utf-8'), 'msg' : diag_msg or '' } ) + pname = Surname() + pname.set_surname(patronym) + pname.set_origintype(NameOriginType.PATRONYMIC) + name.add_surname(pname) + person.set_primary_name(name) person.set_gender(gender) - alias = recflds[alias_ix] - per_code = recflds[per_code_ix] - title1 = recflds[title1_ix] - title2 = recflds[title2_ix] - title3 = recflds[title3_ix] - per_klad = recflds[per_klad_ix] - per_info = recflds[per_info_ix] + per_code = recflds[per_code_ix] # INDI REFN + if per_code: + attr = Attribute() + attr.set_type((AttributeType.CUSTOM, "REFN")) + attr.set_value(per_code) + person.add_attribute(attr) + + per_klad = recflds[per_klad_ix] # INDI _COMM/INDI COMM + per_info = recflds[per_info_ix] # INDI NOTE note_txt = [_f for _f in [per_info, per_klad] if _f] if note_txt: @@ -867,14 +916,6 @@ class ProgenParser(object): name.set_type(NameType.AKA) person.add_alternate_name(name) - # Debug unused fields - for v,t in ((per_code, 'Persoon code'), - (title1, 'Title1'), - (title2, 'Title2'), - (title3, 'Title3')): - if v: - log.warning("%s: %s: '%s'" % (diag_msg, t, v)) - if recflds[occu_ix]: event, event_ref = self.__create_event_and_ref(EventType.OCCUPATION, recflds[occu_ix]) person.add_event_ref(event_ref) @@ -884,59 +925,44 @@ class ProgenParser(object): place = self.__get_or_create_place(recflds[birth_place_ix]) time = recflds[birth_time_ix] if time: - time = "tijd: " + time - srcref = self.__get_or_create_source(recflds[birth_source_ix], recflds[birth_aktenr_ix]) + time_text = "tijd: " + time + else: + time_text = None + source_title = recflds[birth_source_ix] + source_refn = recflds[birth_aktenr_ix] source_text = recflds[birth_source_text_ix] + citation = self.__get_or_create_citation(source_title, + source_refn, + source_text) info = recflds[birth_info_ix] - if date or place or info or srcref: - desc = [_f for _f in [info, time, source_text] if _f] + if date or place or info or citation: + desc = [_f for _f in [info, time_text, source_text] if _f] desc = desc and '; '.join(desc) or None - event, birth_ref = self.__create_event_and_ref(EventType.BIRTH, desc, date, place, srcref) + event, birth_ref = self.__create_event_and_ref(EventType.BIRTH, desc, date, place, citation, info, time) person.set_birth_ref(birth_ref) - if source_text: - note_text = "Brontekst: " + source_text - log.warning("Birth, %s: '%s'" % (diag_msg, note_text)) - note = Note() - note.set(note_txt) - note.set_type(NoteType.EVENT) - self.db.add_note(note, self.trans) - event.add_note(note.handle) - self.db.commit_event(event, self.trans) # Baptism date = self.__create_date_from_text(recflds[bapt_date_ix], diag_msg) place = self.__get_or_create_place(recflds[bapt_place_ix]) reli = recflds[bapt_reli_ix] witness = recflds[bapt_witn_ix] - srcref = self.__get_or_create_source(recflds[bapt_source_ix], recflds[bapt_aktenr_ix]) + source_title = recflds[bapt_source_ix] + source_refn = recflds[bapt_aktenr_ix] source_text = recflds[bapt_source_text_ix] + citation = self.__get_or_create_citation(source_title, + source_refn, + source_text) info = recflds[bapt_info_ix] - if date or place or info or srcref or reli or witness: + if date or place or info or citation or reli or witness: desc = [_f for _f in [reli, info, source_text] if _f] desc = desc and '; '.join(desc) or None - event, bapt_ref = self.__create_event_and_ref(EventType.BAPTISM, desc, date, place, srcref) + event, bapt_ref = self.__create_event_and_ref(EventType.BAPTISM, desc, date, place, citation, info) person.add_event_ref(bapt_ref) if witness: attr = Attribute() attr.set_type(AttributeType.WITNESS) attr.set_value(witness) event.add_attribute(attr) - if source_text: - note_text = "Brontekst: " + source_text - log.warning("Baptism, %s: '%s'" % (diag_msg, note_text)) - note = Note() - note.set(note_txt) - note.set_type(NoteType.EVENT) - self.db.add_note(note, self.trans) - event.add_note(note.handle) - if source_text: - note_text = "Brontekst: " + source_text - log.warning("Baptism, %s: '%s'" % (diag_msg, note_text)) - note = Note() - note.set(note_txt) - note.set_type(NoteType.EVENT) - self.db.add_note(note, self.trans) - event.add_note(note.handle) # Death date = self.__create_date_from_text(recflds[death_date_ix], diag_msg) @@ -944,66 +970,51 @@ class ProgenParser(object): time = recflds[death_time_ix] if time: time = "tijd: " + time - srcref = self.__get_or_create_source(recflds[death_source_ix], recflds[death_aktenr_ix]) + source_title = recflds[death_source_ix] + source_refn = recflds[death_aktenr_ix] source_text = recflds[death_source_text_ix] info = recflds[death_info_ix] - if date or place or info or srcref: + citation = self.__get_or_create_citation(source_title, + source_refn, + source_text) + if date or place or info or citation: desc = [_f for _f in [info, time, source_text] if _f] desc = desc and '; '.join(desc) or None - event, death_ref = self.__create_event_and_ref(EventType.DEATH, desc, date, place, srcref) + event, death_ref = self.__create_event_and_ref(EventType.DEATH, desc, date, place, citation, info, time) person.set_death_ref(death_ref) - if source_text: - note_text = "Brontekst: " + source_text - log.warning("Death, %s: '%s'" % (diag_msg, note_text)) - note = Note() - note.set(note_txt) - note.set_type(NoteType.EVENT) - self.db.add_note(note, self.trans) - event.add_note(note.handle) - self.db.commit_event(event, self.trans) # Burial date = self.__create_date_from_text(recflds[bur_date_ix], diag_msg) place = self.__get_or_create_place(recflds[bur_place_ix]) - srcref = self.__get_or_create_source(recflds[bur_source_ix], recflds[bur_aktenr_ix]) + source_title = recflds[bur_source_ix] + source_refn = recflds[bur_aktenr_ix] source_text = recflds[bur_source_text_ix] + citation = self.__get_or_create_citation(source_title, + source_refn, + source_text) info = recflds[bur_info_ix] - if date or place or info or srcref: + if date or place or info or citation: desc = [_f for _f in [info, source_text] if _f] desc = desc and '; '.join(desc) or None - event, burial_ref = self.__create_event_and_ref(EventType.BURIAL, desc, date, place, srcref) + event, burial_ref = self.__create_event_and_ref(EventType.BURIAL, desc, date, place, citation, info) person.add_event_ref(burial_ref) - if source_text: - note_text = "Brontekst: " + source_text - log.warning("Burial, %s: '%s'" % (diag_msg, note_text)) - note = Note() - note.set(note_txt) - note.set_type(NoteType.EVENT) - self.db.add_note(note, self.trans) - event.add_note(note.handle) - self.db.commit_event(event, self.trans) # Cremation date = self.__create_date_from_text(recflds[crem_date_ix], diag_msg) place = self.__get_or_create_place(recflds[crem_place_ix]) - srcref = self.__get_or_create_source(recflds[crem_source_ix], recflds[crem_aktenr_ix]) + source_title = recflds[crem_source_ix] + source_refn = recflds[crem_aktenr_ix] source_text = recflds[crem_source_text_ix] + citation = self.__get_or_create_citation(source_title, + source_refn, + source_text) info = recflds[crem_info_ix] - if date or place or info or srcref: + if date or place or info or citation: # TODO. Check that not both burial and cremation took place. desc = [_f for _f in [info, source_text] if _f] desc = desc and '; '.join(desc) or None - event, cremation_ref = self.__create_event_and_ref(EventType.CREMATION, desc, date, place, srcref) + event, cremation_ref = self.__create_event_and_ref(EventType.CREMATION, desc, date, place, citation) person.add_event_ref(cremation_ref) - if source_text: - note_text = "Brontekst: " + source_text - log.warning("Cremation, %s: '%s'" % (diag_msg, note_text)) - note = Note() - note.set(note_txt) - note.set_type(NoteType.EVENT) - self.db.add_note(note, self.trans) - event.add_note(note.handle) - self.db.commit_event(event, self.trans) # TODO. Address date = self.__create_date_from_text(recflds[addr_date_ix], diag_msg) @@ -1012,7 +1023,25 @@ class ProgenParser(object): place = self.__get_or_create_place(recflds[addr_place_ix]) country = recflds[addr_country_ix] telno = recflds[addr_telno_ix] - info = recflds[addr_info_ix] + info = recflds[addr_info_ix] # INDI RESI NOTE/INDI ADDR + if place: + loc = Location() + loc.set_street(street) + loc.set_postal_code(postal) + loc.set_country(country) + loc.set_phone(telno) + place.set_main_location(loc) + self.db.commit_place(place, self.trans) + desc = info or None + event, resi_ref = self.__create_event_and_ref(EventType.RESIDENCE, desc, date, place) + if info: + note = Note() + note.set(info) + note.set_type(NoteType.EVENT) + self.db.add_note(note, self.trans) + event.add_note(note.handle) + self.db.commit_event(event, self.trans) + person.add_event_ref(resi_ref) self.db.commit_person(person, self.trans) self.progress.step() @@ -1081,22 +1110,24 @@ class ProgenParser(object): recflds = table.convert_record_to_list(rec, self.mems) self.highest_fam_id = fam_id - fam = self.__find_or_create_family("F%d" % fam_id) + fam = self.__find_or_create_family(fam_id) husband_handle = None if husband > 0: - husband_handle = self.__find_person_handle("I%d" % husband) + husband_handle = self.__find_person_handle(husband) fam.set_father_handle(husband_handle) husband_person = self.db.get_person_from_handle(husband_handle) husband_person.add_family_handle(fam.get_handle()) self.db.commit_person(husband_person, self.trans) wife_handle = None if wife > 0: - wife_handle = self.__find_person_handle("I%d" % wife) + wife_handle = self.__find_person_handle(wife) fam.set_mother_handle(wife_handle) wife_person = self.db.get_person_from_handle(wife_handle) wife_person.add_family_handle(fam.get_handle()) self.db.commit_person(wife_person, self.trans) - diag_msg = "F%d: I%d I%d" % (fam_id, husband, wife) + diag_msg = "%s: %s %s" % (fam.gramps_id, + husband_person.gramps_id if husband_handle else "", + wife_person.gramps_id if wife_handle else "") self.fm2fam[husband_handle, wife_handle] = fam rel_code = recflds[rel_code_ix] @@ -1111,22 +1142,28 @@ class ProgenParser(object): self.db.add_note(note, self.trans) fam.add_note(note.handle) - # Debug unused fields - for v,t in ((rel_code, 'Relatie code'),): - if v: - log.warning("%s: %s: '%s'" % (diag_msg, t, v)) + if rel_code: + attr = Attribute() + attr.set_type((AttributeType.CUSTOM, "REFN")) + attr.set_value(rel_code) + fam.add_attribute(attr) # Wettelijk => Marriage date = self.__create_date_from_text(recflds[mar_date_ix], diag_msg) place = self.__get_or_create_place(recflds[mar_place_ix]) witness = recflds[mar_witn_ix] - srcref = self.__get_or_create_source(recflds[mar_source_ix], recflds[mar_aktenr_ix]) + citation = self.__get_or_create_citation(recflds[mar_source_ix], recflds[mar_aktenr_ix]) + source_title = recflds[mar_source_ix] + source_refn = recflds[mar_aktenr_ix] source_text = recflds[mar_source_text_ix] + citation = self.__get_or_create_citation(source_title, + source_refn, + source_text) info = recflds[mar_info_ix] - if date or place or info or srcref: + if date or place or info or citation: desc = [_f for _f in [info, source_text] if _f] desc = desc and '; '.join(desc) or None - event, mar_ref = self.__create_event_and_ref(EventType.MARRIAGE, desc, date, place, srcref) + event, mar_ref = self.__create_event_and_ref(EventType.MARRIAGE, desc, date, place, citation, info) fam.add_event_ref(mar_ref) if witness: attr = Attribute() @@ -1134,15 +1171,6 @@ class ProgenParser(object): attr.set_value(witness) event.add_attribute(attr) self.db.commit_event(event, self.trans) - if source_text: - note_text = "Brontekst: " + source_text - log.warning("Wettelijk huwelijk, %s: '%s'" % (diag_msg, note_text)) - note = Note() - note.set(note_txt) - note.set_type(NoteType.EVENT) - self.db.add_note(note, self.trans) - event.add_note(note.handle) - self.db.commit_event(event, self.trans) # Type of relation fam.set_relationship(FamilyRelType(FamilyRelType.MARRIED)) @@ -1152,14 +1180,19 @@ class ProgenParser(object): place = self.__get_or_create_place(recflds[marc_place_ix]) reli = recflds[marc_reli_ix] witness = recflds[marc_witn_ix] - srcref = self.__get_or_create_source(recflds[marc_source_ix], recflds[marc_aktenr_ix]) + citation = self.__get_or_create_citation(recflds[marc_source_ix], recflds[marc_aktenr_ix]) + source_title = recflds[marc_source_ix] + source_refn = recflds[marc_aktenr_ix] source_text = recflds[marc_source_text_ix] + citation = self.__get_or_create_citation(source_title, + source_refn, + source_text) info = recflds[marc_info_ix] - if date or place or info or srcref: + if date or place or info or citation: desc = [_f for _f in [reli, info, source_text] if _f] desc.insert(0, 'Kerkelijk huwelijk') desc = desc and '; '.join(desc) or None - event, marc_ref = self.__create_event_and_ref(EventType.MARRIAGE, desc, date, place, srcref) + event, marc_ref = self.__create_event_and_ref(EventType.MARRIAGE, desc, date, place, citation, info) fam.add_event_ref(marc_ref) if witness: attr = Attribute() @@ -1167,15 +1200,6 @@ class ProgenParser(object): attr.set_value(witness) event.add_attribute(attr) self.db.commit_event(event, self.trans) - if source_text: - note_text = "Brontekst: " + source_text - log.warning("Kerkelijk huwelijk, %s: '%s'" % (diag_msg, note_text)) - note = Note() - note.set(note_txt) - note.set_type(NoteType.EVENT) - self.db.add_note(note, self.trans) - event.add_note(note.handle) - self.db.commit_event(event, self.trans) # Type of relation fam.set_relationship(FamilyRelType(FamilyRelType.MARRIED)) @@ -1184,14 +1208,19 @@ class ProgenParser(object): date = self.__create_date_from_text(recflds[marl_date_ix], diag_msg) place = self.__get_or_create_place(recflds[marl_place_ix]) witness = recflds[marl_witn_ix] - srcref = self.__get_or_create_source(recflds[marl_source_ix], recflds[marl_aktenr_ix]) + citation = self.__get_or_create_citation(recflds[marl_source_ix], recflds[marl_aktenr_ix]) + source_title = recflds[marl_source_ix] + source_refn = recflds[marl_aktenr_ix] source_text = recflds[marl_source_text_ix] + citation = self.__get_or_create_citation(source_title, + source_refn, + source_text) info = recflds[marl_info_ix] - if date or place or info or srcref: + if date or place or info or citation: desc = [_f for _f in [info, source_text] if _f] desc.insert(0, 'Ondertrouw') desc = desc and '; '.join(desc) or None - event, marl_ref = self.__create_event_and_ref(EventType.MARR_LIC, desc, date, place, srcref) + event, marl_ref = self.__create_event_and_ref(EventType.MARR_LIC, desc, date, place, citation, info) fam.add_event_ref(marl_ref) if witness: attr = Attribute() @@ -1199,50 +1228,42 @@ class ProgenParser(object): attr.set_value(witness) event.add_attribute(attr) self.db.commit_event(event, self.trans) - if source_text: - note_text = "Brontekst: " + source_text - log.warning("Ondertrouw, %s: '%s'" % (diag_msg, note_text)) - note = Note() - note.set(note_txt) - note.set_type(NoteType.EVENT) - self.db.add_note(note, self.trans) - event.add_note(note.handle) - self.db.commit_event(event, self.trans) # Samenwonen => Civil Union date = self.__create_date_from_text(recflds[civu_date_ix], diag_msg) place = self.__get_or_create_place(recflds[civu_place_ix]) - srcref = self.__get_or_create_source(recflds[civu_source_ix], recflds[civu_aktenr_ix]) + citation = self.__get_or_create_citation(recflds[civu_source_ix], recflds[civu_aktenr_ix]) + source_title = recflds[civu_source_ix] + source_refn = recflds[civu_aktenr_ix] source_text = recflds[civu_source_text_ix] + citation = self.__get_or_create_citation(source_title, + source_refn, + source_text) info = recflds[civu_info_ix] - if date or place or info or srcref: + if date or place or info or citation: desc = [_f for _f in [info, source_text] if _f] desc.insert(0, 'Samenwonen') desc = desc and '; '.join(desc) or None - event, civu_ref = self.__create_event_and_ref(EventType.UNKNOWN, desc, date, place, srcref) + event, civu_ref = self.__create_event_and_ref(EventType.UNKNOWN, desc, date, place, citation, info) fam.add_event_ref(civu_ref) # Type of relation fam.set_relationship(FamilyRelType(FamilyRelType.CIVIL_UNION)) - if source_text: - note_text = "Brontekst: " + source_text - log.warning("Samenwonen, %s: '%s'" % (diag_msg, note_text)) - note = Note() - note.set(note_txt) - note.set_type(NoteType.EVENT) - self.db.add_note(note, self.trans) - event.add_note(note.handle) - self.db.commit_event(event, self.trans) # Scheiding => Divorce date = self.__create_date_from_text(recflds[div_date_ix], diag_msg) place = self.__get_or_create_place(recflds[div_place_ix]) - srcref = self.__get_or_create_source(recflds[div_source_ix], recflds[div_aktenr_ix]) + citation = self.__get_or_create_citation(recflds[div_source_ix], recflds[div_aktenr_ix]) + source_title = recflds[div_source_ix] + source_refn = recflds[div_aktenr_ix] source_text = recflds[div_source_text_ix] + citation = self.__get_or_create_citation(source_title, + source_refn, + source_text) info = recflds[div_info_ix] - if date or place or info or srcref: + if date or place or info or citation: desc = [_f for _f in [info, source_text] if _f] desc = desc and '; '.join(desc) or None - event, div_ref = self.__create_event_and_ref(EventType.DIVORCE, desc, date, place, srcref) + event, div_ref = self.__create_event_and_ref(EventType.DIVORCE, desc, date, place, citation, info) fam.add_event_ref(div_ref) self.db.commit_family(fam, self.trans) @@ -1264,9 +1285,9 @@ class ProgenParser(object): mother = rec[mother_ix] if father > 0 or mother > 0: # Find the family with this father and mother - person_handle = self.__find_person_handle("I%d" % pers_id) - father_handle = father > 0 and self.__find_person_handle("I%d" % father) or None - mother_handle = mother > 0 and self.__find_person_handle("I%d" % mother) or None + person_handle = self.__find_person_handle(pers_id) + father_handle = father > 0 and self.__find_person_handle(father) or None + mother_handle = mother > 0 and self.__find_person_handle(mother) or None if father > 0 and not father_handle: log.warning(_("cannot find father for I%(person)s (father=%(id)d)") % { 'person' : pers_id, 'id' : father } ) @@ -1279,7 +1300,7 @@ class ProgenParser(object): # Family not present in REL. Create a new one. self.highest_fam_id = self.highest_fam_id + 1 fam_id = self.highest_fam_id - fam = self.__find_or_create_family("F%d" % fam_id) + fam = self.__find_or_create_family(fam_id) if father_handle: fam.set_father_handle(father_handle) father_person = self.db.get_person_from_handle(father_handle)