diff --git a/gramps/gen/db/utils.py b/gramps/gen/db/utils.py index fe96160545..5fb96cbdcd 100644 --- a/gramps/gen/db/utils.py +++ b/gramps/gen/db/utils.py @@ -184,26 +184,22 @@ def import_from_filename(db, filename, user): return False -def find_surname_name(key, data): +def find_surname_name(surname_list): """ - Creating a surname from raw name, to use for sort and index - returns a byte string - """ - return __index_surname(data[5]) - + Create a surname-string to use for sort and index. -def __index_surname(surn_list): - """ All non pa/matronymic surnames are used in indexing. pa/matronymic not as they change for every generation! - returns a byte string + + Returns a string. """ - if surn_list: + if surname_list: surn = " ".join( [ - x[0] - for x in surn_list - if x[3][0] not in [NameOriginType.PATRONYMIC, NameOriginType.MATRONYMIC] + surname.surname + for surname in surname_list + if surname.origintype.value + not in [NameOriginType.PATRONYMIC, NameOriginType.MATRONYMIC] ] ) else: diff --git a/gramps/plugins/tool/changenames.py b/gramps/plugins/tool/changenames.py index e7f6f6e1fa..d88c107047 100644 --- a/gramps/plugins/tool/changenames.py +++ b/gramps/plugins/tool/changenames.py @@ -278,7 +278,7 @@ def on_ok_clicked(self, obj): # person = Person(data) change = False for name in [person.get_primary_name()] + person.get_alternate_names(): - sname = find_surname_name(handle, name.serialize()) + sname = find_surname_name(name.surname_list) if sname in changelist: change = True for surn in name.get_surname_list():