From c7d8f6ba6e854c5cceba579327f4ec3ee6c4829e Mon Sep 17 00:00:00 2001 From: prculley Date: Wed, 27 Apr 2016 16:04:28 -0500 Subject: [PATCH] Bug 9173, fix broken GEDCOM import PLAC:FORM handling --- gramps/plugins/lib/libgedcom.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/gramps/plugins/lib/libgedcom.py b/gramps/plugins/lib/libgedcom.py index 05c1d6d2d..d75a42654 100755 --- a/gramps/plugins/lib/libgedcom.py +++ b/gramps/plugins/lib/libgedcom.py @@ -1708,8 +1708,6 @@ class PlaceParser(object): loc.get_state(), loc.get_country()) - place_import.store_location(location, place.handle) - for level, name in enumerate(location): if name: break @@ -1723,6 +1721,10 @@ class PlaceParser(object): place.set_type(PlaceType(type_num)) code = loc.get_postal_code() place.set_code(code) + if place.handle: # if handle is available, store immediately + place_import.store_location(location, place.handle) + else: # return for storage later + return location #------------------------------------------------------------------------- # @@ -2957,15 +2959,22 @@ class GedcomParser(UpdateCallback): sub_state.place.get_placeref_list()) if place is None: place = sub_state.place + place_title = place_displayer.display(self.dbase, place) + location = sub_state.pf.load_place(self.place_import, place, place_title) self.dbase.add_place(place, self.trans) + # if 'location was created, then store it, now that we have a handle. + if location: + self.place_import.store_location(location, place.handle) self.place_names[place.get_title()].append(place.get_handle()) event.set_place_handle(place.get_handle()) else: place.merge(sub_state.place) + place_title = place_displayer.display(self.dbase, place) + location = sub_state.pf.load_place(self.place_import, place, place_title) self.dbase.commit_place(place, self.trans) + if location: + self.place_import.store_location(location, place.handle) event.set_place_handle(place.get_handle()) - place_title = place_displayer.display(self.dbase, place) - sub_state.pf.load_place(self.place_import, place, place_title) def __find_file(self, fullname, altpath): tries = []