From ae204b8bb04124af046c80d22dbc380ddbc4b1f2 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Tue, 29 Oct 2024 04:47:52 -0400 Subject: [PATCH] Import from XML working --- gramps/gen/db/generic.py | 2 +- gramps/plugins/importer/importxml.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/gramps/gen/db/generic.py b/gramps/gen/db/generic.py index b0bea8a8327..1bdfd529655 100644 --- a/gramps/gen/db/generic.py +++ b/gramps/gen/db/generic.py @@ -1943,7 +1943,7 @@ def commit_person(self, person, transaction, change_time=None): old_data = self._commit_base(person, PERSON_KEY, transaction, change_time) if old_data: - old_person = Person(old_data) + old_person = from_struct(old_data) # Update gender statistics if necessary if old_person.gender != person.gender or ( old_person.primary_name.first_name != person.primary_name.first_name diff --git a/gramps/plugins/importer/importxml.py b/gramps/plugins/importer/importxml.py index b6926e94836..5c51d9a4e11 100644 --- a/gramps/plugins/importer/importxml.py +++ b/gramps/plugins/importer/importxml.py @@ -91,6 +91,7 @@ Tag, Url, ) +from gramps.gen.lib.serialize import from_struct from gramps.gen.db import DbTxn # from gramps.gen.db.write import CLASS_TO_KEY_MAP @@ -839,7 +840,8 @@ class object of a primary object. "tag": self.db.get_raw_tag_data, }[target] raw = get_raw_obj_data(handle) - prim_obj.unserialize(raw) + temp_obj = from_struct(raw) + prim_obj.set_object_state(temp_obj.get_object_state()) self.import_handles[orig_handle][target][INSTANTIATED] = True return handle elif handle in self.import_handles: @@ -1000,7 +1002,8 @@ def inaugurate_id(self, id_, key, prim_obj): handle = id2handle_map.get(gramps_id) if handle: raw = get_raw_obj_data(handle) - prim_obj.unserialize(raw) + temp_obj = from_struct(raw) + prim_obj.set_object_state(temp_obj.get_object_state()) else: handle = create_id() while has_handle_func(handle):