def latin_american(self): """ Child inherits name from father and mother """ name = Name() #the editor requires a surname name.add_surname(Surname()) name.set_primary_surname(0) if self.family: father_handle = self.family.get_father_handle() mother_handle = self.family.get_mother_handle() father = self.dbstate.db.get_person_from_handle(father_handle) mother = self.dbstate.db.get_person_from_handle(mother_handle) if not father and not mother: return name if not father: preset_name(mother, name) return name if not mother: preset_name(father, name) return name #we take first surname, and keep that mothername = Name() preset_name(mother, mothername) preset_name(father, name) mothersurname = mothername.get_surname_list()[0] mothersurname.set_primary(False) name.set_surname_list([name.get_surname_list()[0], mothersurname]) return name else: return name
def latin_american_child(self, parent): """ If SURNAME_GUESSING is latin american, then find a child and return their name for the father or mother. parent = "mother" | "father" """ name = Name() #the editor requires a surname name.add_surname(Surname()) name.set_primary_surname(0) # for each child, find one with a last name for ref in self.obj.get_child_ref_list(): child = self.db.get_person_from_handle(ref.ref) if child: pname = child.get_primary_name() preset_name(child, name) if len(name.get_surname_list()) < 2: return name else: #return first for the father, and last for the mother if parent == 'father': name.set_surname_list(name.get_surname_list()[0]) return name else: name.set_surname_list(name.get_surname_list()[-1]) return name return name