From 871180a272ce13b4eec02532609ef19ee70c6bc7 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Tue, 25 Jul 2006 00:24:15 +0000 Subject: [PATCH] Update svn: r7071 --- ChangeLog | 9 +++++---- src/GrampsDb/_GrampsBSDDB.py | 13 ++++++++----- src/GrampsDb/_ReadXML.py | 4 ++-- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index d5db1aca8..1b885e137 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,10 +4,11 @@ * src/docgen/OpenOfficeDoc.py: fix rotation angle 2006-07-24 Alex Roitman - * src/GrampsDb/_GrampsBSDDB.py (gramps_upgrade_9): Map Other from - gramps2.0.x to Unknown. - * src/GrampsDb/_ReadXML.py (start_name): Map Other from - gramps2.0.x to Unknown. + * src/GrampsDb/_GrampsBSDDB.py (gramps_upgrade_9): Map "Other + Name" from gramps2.0.x to the "Unknown" name type; + work out the case of no events. + * src/GrampsDb/_ReadXML.py (start_name): Map "Other Name" from + gramps2.0.x to the "Unknown" name type. (start_database): Add method to extract the XML version. * src/DisplayTabs/_BackRefModel.py (BackRefModel.load_model): Translate displayed object type. diff --git a/src/GrampsDb/_GrampsBSDDB.py b/src/GrampsDb/_GrampsBSDDB.py index 59913faf7..35337cda9 100644 --- a/src/GrampsDb/_GrampsBSDDB.py +++ b/src/GrampsDb/_GrampsBSDDB.py @@ -1474,8 +1474,8 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback): for name in [person.primary_name] + person.alternate_names: old_type = name.type new_type = NameType() - # Mapping "Other" from gramps 2.0.x to Unknown - if old_type == 'Other': + # Mapping "Other Name" from gramps 2.0.x to Unknown + if old_type == 'Other Name': new_type.set(NameType.UNKNOWN) else: new_type.set_from_xml_str(old_type) @@ -1554,9 +1554,12 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback): # Find the largest ID and extract the integer: # We can do this because in 2.0.x the event id is never exposed eid_list.sort() - last_id = eid_list[-1] - nre = re.compile("\D+(\d+)") - max_id_number = int(nre.match(last_id).groups()[0]) + if len(eid_list) == 0: + max_id_number = 0 + else: + last_id = eid_list[-1] + nre = re.compile("\D+(\d+)") + max_id_number = int(nre.match(last_id).groups()[0]) # get the list of all IDs that are non-unique dup_ids = [eid for eid in eid_list if eid_list.count(eid) > 1 ] diff --git a/src/GrampsDb/_ReadXML.py b/src/GrampsDb/_ReadXML.py index db847681c..dfbb5d8d7 100644 --- a/src/GrampsDb/_ReadXML.py +++ b/src/GrampsDb/_ReadXML.py @@ -1016,8 +1016,8 @@ class GrampsParser(UpdateCallback): if not self.in_witness: self.name = RelLib.Name() name_type = attrs['type'] - # Mapping "Other" from gramps 2.0.x to Unknown - if (self.version_string == '1.0.0') and (name_type == 'Other'): + # Mapping "Other Name" from gramps 2.0.x to Unknown + if (self.version_string=='1.0.0') and (name_type=='Other Name'): self.name.set_type(RelLib.NameType.UNKNOWN) else: self.name.type.set_from_xml_str(name_type)