Skip to content

Commit

Permalink
Remove serialize from changenames
Browse files Browse the repository at this point in the history
  • Loading branch information
dsblank committed Jan 4, 2025
1 parent 75c5053 commit 86f0ab5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
22 changes: 9 additions & 13 deletions gramps/gen/db/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion gramps/plugins/tool/changenames.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit 86f0ab5

Please sign in to comment.