3296: Data loss during XML-export->import; assumed type was set on name element

svn: r13380
This commit is contained in:
Doug Blank 2009-10-17 22:50:35 +00:00
parent 054acb7337
commit d899d1eefd

View File

@ -1276,14 +1276,14 @@ class GrampsParser(UpdateCallback):
def start_name(self, attrs): def start_name(self, attrs):
if not self.in_witness: if not self.in_witness:
self.name = gen.lib.Name() self.name = gen.lib.Name()
name_type = attrs['type'] name_type = attrs.get('type', "Birth Name")
# Mapping "Other Name" from gramps 2.0.x to Unknown # Mapping "Other Name" from gramps 2.0.x to Unknown
if (self.version_string=='1.0.0') and (name_type=='Other Name'): if (self.version_string=='1.0.0') and (name_type=='Other Name'):
self.name.set_type(gen.lib.NameType.UNKNOWN) self.name.set_type(gen.lib.NameType.UNKNOWN)
else: else:
self.name.type.set_from_xml_str(name_type) self.name.type.set_from_xml_str(name_type)
self.name.private = bool(attrs.get("priv")) self.name.private = bool(attrs.get("priv", 0))
self.alt_name = bool(attrs.get("alt")) self.alt_name = bool(attrs.get("alt", 0))
try: try:
sort_as = int(attrs["sort"]) sort_as = int(attrs["sort"])
display_as = int(attrs["display"]) display_as = int(attrs["display"])