Skip to content

Commit

Permalink
Bugfix for calling .decode(...) on str objects
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-nicholson committed Sep 8, 2024
1 parent e84b26d commit 9691c8f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions gramps/gen/db/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,9 @@ def gramps_upgrade_17(self):
n -= 1

if parent_handle is not None:
placeref_list = [(parent_handle.decode("utf-8"), None)]
if isinstance(parent_handle, bytes):
parent_handle = parent_handle.decode("utf-8")
placeref_list = [(parent_handle, None)]
else:
placeref_list = []

Expand Down Expand Up @@ -487,7 +489,9 @@ def add_place(self, name, level, parent, title):
gid = self.place_prefix % self.max_id
placetype = (7 - level, "")
if parent is not None:
placeref_list = [(parent.decode("utf-8"), None)]
if isinstance(parent, bytes):
parent = parent.decode("utf-8")
placeref_list = [(parent, None)]
else:
placeref_list = []
place = (
Expand Down

0 comments on commit 9691c8f

Please sign in to comment.