* 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.
	(start_database): Add method to extract the XML version.


svn: r7070
This commit is contained in:
Alex Roitman 2006-07-25 00:01:08 +00:00
parent 488cf0300b
commit 87c460c966
3 changed files with 28 additions and 4 deletions

View File

@ -4,6 +4,11 @@
* src/docgen/OpenOfficeDoc.py: fix rotation angle
2006-07-24 Alex Roitman <shura@gramps-project.org>
* 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.
(start_database): Add method to extract the XML version.
* src/DisplayTabs/_BackRefModel.py (BackRefModel.load_model):
Translate displayed object type.
* debian/control (Build-Depends-Indep): Add python-central;

View File

@ -1474,7 +1474,11 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback):
for name in [person.primary_name] + person.alternate_names:
old_type = name.type
new_type = NameType()
new_type.set_from_xml_str(old_type)
# Mapping "Other" from gramps 2.0.x to Unknown
if old_type == 'Other':
new_type.set(NameType.UNKNOWN)
else:
new_type.set_from_xml_str(old_type)
name.type = new_type
name.call = ''

View File

@ -372,7 +372,7 @@ class GrampsParser(UpdateCallback):
"comment" : (None, self.stop_comment),
"created" : (self.start_created, None),
"ref" : (None, self.stop_ref),
"database" : (None, self.stop_database),
"database" : (self.start_database, self.stop_database),
"phone" : (None, self.stop_phone),
"date" : (None, self.stop_date),
"cause" : (None, self.stop_cause),
@ -1015,7 +1015,12 @@ class GrampsParser(UpdateCallback):
def start_name(self,attrs):
if not self.in_witness:
self.name = RelLib.Name()
self.name.type.set_from_xml_str(attrs['type'])
name_type = attrs['type']
# Mapping "Other" from gramps 2.0.x to Unknown
if (self.version_string == '1.0.0') and (name_type == 'Other'):
self.name.set_type(RelLib.NameType.UNKNOWN)
else:
self.name.type.set_from_xml_str(name_type)
self.name.set_private = bool(attrs.get("priv"))
self.alt_name = bool(attrs.get("alt"))
try:
@ -1356,6 +1361,16 @@ class GrampsParser(UpdateCallback):
else:
self.num_places = 0
def start_database(self,attrs):
try:
# This is a proper way to get the XML version
xmlns = attrs.get('xmlns')
self.version_string = xmlns.split('/')[4]
except:
# Before we had a proper DTD, the version was hard to determine
# so we're setting it to 1.0.0
self.version_string = '1.0.0'
def start_pos(self,attrs):
self.person.position = (int(attrs["x"]), int(attrs["y"]))
@ -1724,7 +1739,7 @@ class GrampsParser(UpdateCallback):
def stop_aka(self,tag):
self.person.add_alternate_name(self.name)
if self.name.get_type() == "":
self.name.set_type("Also Known As")
self.name.set_type(RelLib.NameType.AKA)
self.name = None
def startElement(self,tag,attrs):