Bug 9173, fix broken GEDCOM import PLAC:FORM handling

This commit is contained in:
prculley 2016-05-12 09:55:59 -05:00
parent 9424539930
commit dd7724eca2

View File

@ -1705,8 +1705,6 @@ class PlaceParser:
loc.get_state(), loc.get_state(),
loc.get_country()) loc.get_country())
place_import.store_location(location, place.handle)
for level, name in enumerate(location): for level, name in enumerate(location):
if name: if name:
break break
@ -1720,6 +1718,10 @@ class PlaceParser:
place.set_type(PlaceType(type_num)) place.set_type(PlaceType(type_num))
code = loc.get_postal_code() code = loc.get_postal_code()
place.set_code(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
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -2954,15 +2956,22 @@ class GedcomParser(UpdateCallback):
sub_state.place.get_placeref_list()) sub_state.place.get_placeref_list())
if place is None: if place is None:
place = sub_state.place 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) 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()) self.place_names[place.get_title()].append(place.get_handle())
event.set_place_handle(place.get_handle()) event.set_place_handle(place.get_handle())
else: else:
place.merge(sub_state.place) place.merge(sub_state.place)
self.dbase.commit_place(place, self.trans)
event.set_place_handle(place.get_handle())
place_title = place_displayer.display(self.dbase, place) place_title = place_displayer.display(self.dbase, place)
sub_state.pf.load_place(self.place_import, place, place_title) 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())
def __find_file(self, fullname, altpath): def __find_file(self, fullname, altpath):
tries = [] tries = []