From 9cc216ed2efd08ea5578881dc8e987cbaca4f813 Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Sat, 12 Jul 2014 19:58:17 +0100 Subject: [PATCH] 7904: Fix place type for places without a main location --- gramps/gen/db/upgrade.py | 2 +- gramps/gen/lib/placetype.py | 2 +- gramps/plugins/importer/importxml.py | 2 +- gramps/plugins/lib/libgedcom.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gramps/gen/db/upgrade.py b/gramps/gen/db/upgrade.py index 2b4a785e3..398146dd3 100644 --- a/gramps/gen/db/upgrade.py +++ b/gramps/gen/db/upgrade.py @@ -161,7 +161,7 @@ def gramps_upgrade_17(self): else: 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, [], PlaceType(type_num).serialize(), zip_code] + \ new_place[6:12] + [[]] + new_place[12:] diff --git a/gramps/gen/lib/placetype.py b/gramps/gen/lib/placetype.py index 7347c7ff3..7b522e475 100644 --- a/gramps/gen/lib/placetype.py +++ b/gramps/gen/lib/placetype.py @@ -61,7 +61,7 @@ class PlaceType(GrampsType): BUILDING = 19 _CUSTOM = CUSTOM - _DEFAULT = COUNTRY + _DEFAULT = UNKNOWN _DATAMAP = [ (UNKNOWN, _("Unknown"), "Unknown"), diff --git a/gramps/plugins/importer/importxml.py b/gramps/plugins/importer/importxml.py index fc86cb12c..4b57d214d 100644 --- a/gramps/plugins/importer/importxml.py +++ b/gramps/plugins/importer/importxml.py @@ -1193,7 +1193,7 @@ class GrampsParser(UpdateCallback): break 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)) codes = [attrs.get('postal'), attrs.get('phone')] self.placeobj.set_code(' '.join(code for code in codes if code)) diff --git a/gramps/plugins/lib/libgedcom.py b/gramps/plugins/lib/libgedcom.py index e7a8e9b42..efda5926e 100644 --- a/gramps/plugins/lib/libgedcom.py +++ b/gramps/plugins/lib/libgedcom.py @@ -1698,7 +1698,7 @@ class PlaceParser(object): break 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)) code = loc.get_postal_code() place.set_code(code)