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
def get_name(self, person, maiden_name=None): """ Return person's name, unless maiden_name given, unless married_name listed. """ # Get all of a person's names: primary_name = person.get_primary_name() married_name = None names = [primary_name] + person.get_alternate_names() for name in names: if int(name.get_type()) == NameType.MARRIED: married_name = name break # use first # Now, decide which to use: if maiden_name is not None: if married_name is not None: name = Name(married_name) else: name = Name(primary_name) surname = Surname() surname.set_surname(maiden_name) name.set_surname_list([surname]) else: name = Name(primary_name) name.set_display_as(self.name_format) return _nd.display_name(name)
def get_name(self, person, maiden_name = None): """ Return person's name, unless maiden_name given, unless married_name listed. """ # Get all of a person's names: primary_name = person.get_primary_name() married_name = None names = [primary_name] + person.get_alternate_names() for name in names: if int(name.get_type()) == NameType.MARRIED: married_name = name break # use first # Now, decide which to use: if maiden_name is not None: if married_name is not None: name = Name(married_name) else: name = Name(primary_name) surname = Surname() surname.set_surname(maiden_name) name.set_surname_list([surname]) else: name = Name(primary_name) name.set_display_as(self.name_format) return _nd.display_name(name)