8810: Ensure place names are not empty after upgrade

This commit is contained in:
Nick Hall 2015-08-15 21:32:51 +01:00
parent 6fc4d1f536
commit a121922310
2 changed files with 7 additions and 1 deletions

View File

@ -200,7 +200,11 @@ def gramps_upgrade_17(self):
else: else:
placeref_list = [] placeref_list = []
type_num = 7 - level if name else -1 if name:
type_num = 7 - level
else:
name = new_place[2]
type_num = -1
new_place = new_place[:5] + [placeref_list, name, [], new_place = new_place[:5] + [placeref_list, name, [],
(type_num, ''), zip_code] + \ (type_num, ''), zip_code] + \
new_place[6:12] + [[]] + new_place[12:] new_place[6:12] + [[]] + new_place[12:]

View File

@ -2619,6 +2619,8 @@ class GrampsParser(UpdateCallback):
self.placeobj.add_alternative_name(place_name) self.placeobj.add_alternative_name(place_name)
def stop_placeobj(self, *tag): def stop_placeobj(self, *tag):
if self.placeobj.name.get_value() == '':
self.placeobj.name.set_value(self.placeobj.title)
self.db.commit_place(self.placeobj, self.trans, self.db.commit_place(self.placeobj, self.trans,
self.placeobj.get_change_time()) self.placeobj.get_change_time())
self.placeobj = None self.placeobj = None