7904: Fix place type for places without a main location

This commit is contained in:
Nick Hall 2014-07-12 19:58:17 +01:00
parent b67b060c8c
commit 9cc216ed2e
4 changed files with 4 additions and 4 deletions

View File

@ -161,7 +161,7 @@ def gramps_upgrade_17(self):
else: else:
placeref_list = [] placeref_list = []
type_num = 7 - level if name else 8 type_num = 7 - level if name else PlaceType.UNKNOWN
new_place = new_place[:5] + [placeref_list, name, [], new_place = new_place[:5] + [placeref_list, name, [],
PlaceType(type_num).serialize(), zip_code] + \ PlaceType(type_num).serialize(), zip_code] + \
new_place[6:12] + [[]] + new_place[12:] new_place[6:12] + [[]] + new_place[12:]

View File

@ -61,7 +61,7 @@ class PlaceType(GrampsType):
BUILDING = 19 BUILDING = 19
_CUSTOM = CUSTOM _CUSTOM = CUSTOM
_DEFAULT = COUNTRY _DEFAULT = UNKNOWN
_DATAMAP = [ _DATAMAP = [
(UNKNOWN, _("Unknown"), "Unknown"), (UNKNOWN, _("Unknown"), "Unknown"),

View File

@ -1193,7 +1193,7 @@ class GrampsParser(UpdateCallback):
break break
self.placeobj.set_name(name) self.placeobj.set_name(name)
type_num = 7 - level if name else 8 type_num = 7 - level if name else PlaceType.UNKNOWN
self.placeobj.set_type(PlaceType(type_num)) self.placeobj.set_type(PlaceType(type_num))
codes = [attrs.get('postal'), attrs.get('phone')] codes = [attrs.get('postal'), attrs.get('phone')]
self.placeobj.set_code(' '.join(code for code in codes if code)) self.placeobj.set_code(' '.join(code for code in codes if code))

View File

@ -1698,7 +1698,7 @@ class PlaceParser(object):
break break
place.set_name(name) place.set_name(name)
type_num = 7 - level if name else 8 type_num = 7 - level if name else PlaceType.UNKNOWN
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)