Skip to content

Commit

Permalink
Fix CSV import for multiple place enclosed by on multiple imports (#869)
Browse files Browse the repository at this point in the history
Fixes #11259
  • Loading branch information
prculley authored Aug 21, 2019
1 parent ba6254c commit ee5f2fa
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions gramps/plugins/importer/importcsv.py
Original file line number Diff line number Diff line change
Expand Up @@ -877,13 +877,17 @@ def _parse_place(self, line_number, row, col):
if place_enclosed_by_id is not None:
place_enclosed_by = self.lookup("place", place_enclosed_by_id)
if place_enclosed_by is None:
raise Exception("cannot enclose %s in %s as it doesn't exist" % (place.gramps_id, place_enclosed_by_id))
if not place_enclosed_by.handle in place.placeref_list:
raise Exception("cannot enclose %s in %s as it doesn't exist" %
(place.gramps_id, place_enclosed_by_id))
for placeref in place.placeref_list:
if place_enclosed_by.handle == placeref.ref:
break
else:
placeref = PlaceRef()
placeref.ref = place_enclosed_by.handle
if place_date:
placeref.date = _dp.parse(place_date)
place.placeref_list.append(placeref)
if place_date:
placeref.date = _dp.parse(place_date)
#########################################################
self.db.commit_place(place, self.trans)

Expand Down

0 comments on commit ee5f2fa

Please sign in to comment.