0008537: Gedcom import crashes. Fix problem when matching places with
the same name which are enclosed by different places.
This commit is contained in:
parent
5ff70a665e
commit
4e6a06bfac
@ -2997,7 +2997,7 @@ class GedcomParser(UpdateCallback):
|
||||
return True
|
||||
return False
|
||||
|
||||
def __find_place(self, title, location):
|
||||
def __find_place(self, title, location, placeref_list):
|
||||
"""
|
||||
Finds an existing place based on the title and primary location.
|
||||
|
||||
@ -3011,11 +3011,13 @@ class GedcomParser(UpdateCallback):
|
||||
place = self.dbase.get_place_from_handle(place_handle)
|
||||
if place.get_title() == title:
|
||||
if self.__loc_is_empty(location) and \
|
||||
self.__loc_is_empty(self.__get_first_loc(place)):
|
||||
self.__loc_is_empty(self.__get_first_loc(place)) and \
|
||||
place.get_placeref_list() == placeref_list:
|
||||
return place
|
||||
elif (not self.__loc_is_empty(location) and \
|
||||
not self.__loc_is_empty(self.__get_first_loc(place)) and
|
||||
self.__get_first_loc(place).is_equivalent(location) == IDENTICAL):
|
||||
self.__get_first_loc(place).is_equivalent(location) == IDENTICAL) and \
|
||||
place.get_placeref_list() == placeref_list:
|
||||
return place
|
||||
return None
|
||||
|
||||
@ -3033,7 +3035,8 @@ class GedcomParser(UpdateCallback):
|
||||
if sub_state.place:
|
||||
# see whether this place already exists
|
||||
place = self.__find_place(sub_state.place.get_title(),
|
||||
self.__get_first_loc(sub_state.place))
|
||||
self.__get_first_loc(sub_state.place),
|
||||
sub_state.place.get_placeref_list())
|
||||
if place is None:
|
||||
place = sub_state.place
|
||||
self.dbase.add_place(place, self.trans)
|
||||
@ -4617,7 +4620,7 @@ class GedcomParser(UpdateCallback):
|
||||
"""
|
||||
try:
|
||||
title = line.data
|
||||
place = self.__find_place(title, None)
|
||||
place = self.__find_place(title, None, None)
|
||||
if place is None:
|
||||
place = Place()
|
||||
place.set_title(title)
|
||||
@ -5604,7 +5607,8 @@ class GedcomParser(UpdateCallback):
|
||||
|
||||
if self.addr_is_detail and state.place:
|
||||
# Commit the enclosing place
|
||||
place = self.__find_place(state.place.get_title(), None)
|
||||
place = self.__find_place(state.place.get_title(), None,
|
||||
state.place.get_placeref_list())
|
||||
if place is None:
|
||||
place = state.place
|
||||
self.dbase.add_place(place, self.trans)
|
||||
|
Loading…
Reference in New Issue
Block a user