* src/RelLib.py: gramps id fixes.
* src/ReadXML.py: gramps id fixes. * src/plugins/ReadGedcom.py: gramps id fixes. svn: r3243
This commit is contained in:
parent
191312c95a
commit
4a3b978f9e
@ -7,6 +7,10 @@
|
||||
* src/plugins/WebPage.py (IndividualPage.write_urls):
|
||||
Add function; (IndividualPage.create_page): use write_urls().
|
||||
|
||||
* src/RelLib.py: gramps id fixes.
|
||||
* src/ReadXML.py: gramps id fixes.
|
||||
* src/plugins/ReadGedcom.py: gramps id fixes.
|
||||
|
||||
2004-06-27 Don Allingham <dallingham@users.sourceforge.net>
|
||||
* src/gramps_main.py: fix import problem
|
||||
|
||||
|
@ -442,7 +442,7 @@ class GrampsParser:
|
||||
self.db.set_researcher(self.owner)
|
||||
if self.tempDefault != None:
|
||||
id = self.tempDefault
|
||||
person = self.db.try_to_find_person_from_gramps_id(id)
|
||||
person = self.db.find_person_from_gramps_id(id,self.trans)
|
||||
if person:
|
||||
self.db.set_default_person_id(person.get_id())
|
||||
|
||||
@ -597,15 +597,15 @@ class GrampsParser:
|
||||
self.tempDefault = attrs["default"]
|
||||
|
||||
def start_father(self,attrs):
|
||||
person = self.db.try_to_find_person_from_gramps_id(self.map_gid(attrs["ref"]))
|
||||
person = self.db.find_person_from_gramps_id(self.map_gid(attrs["ref"]),self.trans)
|
||||
self.family.set_father_id(person.get_id())
|
||||
|
||||
def start_mother(self,attrs):
|
||||
person = self.db.try_to_find_person_from_gramps_id(self.map_gid(attrs["ref"]))
|
||||
person = self.db.find_person_from_gramps_id(self.map_gid(attrs["ref"]),self.trans)
|
||||
self.family.set_mother_id(person.get_id())
|
||||
|
||||
def start_child(self,attrs):
|
||||
person = self.db.try_to_find_person_from_gramps_id(self.map_gid(attrs["ref"]))
|
||||
person = self.db.find_person_from_gramps_id(self.map_gid(attrs["ref"]),self.trans)
|
||||
self.family.add_child_id(person.get_id())
|
||||
|
||||
def start_url(self,attrs):
|
||||
|
@ -2984,17 +2984,20 @@ class GrampsDB:
|
||||
else:
|
||||
return None
|
||||
|
||||
def try_to_find_person_from_gramps_id(self,val):
|
||||
def find_person_from_gramps_id(self,val,trans):
|
||||
"""finds a Person in the database from the passed gramps' ID.
|
||||
If no such Person exists, a new Person is added to the database."""
|
||||
|
||||
person = Person()
|
||||
data = self.idtrans.get(str(val))
|
||||
if data:
|
||||
person = Person()
|
||||
person.unserialize(cPickle.loads(data))
|
||||
return person
|
||||
else:
|
||||
return None
|
||||
intid = Utils.create_id()
|
||||
person.set_id(intid)
|
||||
person.set_gramps_id(val)
|
||||
self.add_person_as(person,trans)
|
||||
return person
|
||||
|
||||
def find_person_from_id(self,val,trans):
|
||||
"""finds a Person in the database from the passed gramps' ID.
|
||||
|
@ -228,9 +228,9 @@ class GedcomParser:
|
||||
|
||||
self.geddir = os.path.dirname(os.path.normpath(os.path.abspath(file)))
|
||||
|
||||
self.trans = string.maketrans('','')
|
||||
self.delc = self.trans[0:31]
|
||||
self.trans2 = self.trans[0:128] + ('?' * 128)
|
||||
self.transtable = string.maketrans('','')
|
||||
self.delc = self.transtable[0:31]
|
||||
self.transtable2 = self.transtable[0:128] + ('?' * 128)
|
||||
|
||||
self.window = window
|
||||
if window:
|
||||
@ -334,14 +334,14 @@ class GedcomParser:
|
||||
if self.backoff == 0:
|
||||
next_line = self.f.readline()
|
||||
try:
|
||||
self.text = string.translate(next_line.strip(),self.trans,self.delc)
|
||||
self.text = string.translate(next_line.strip(),self.transtable,self.delc)
|
||||
except:
|
||||
self.text = next_line.strip()
|
||||
|
||||
try:
|
||||
self.text = self.cnv(self.text)
|
||||
except:
|
||||
self.text = string.translate(self.text,self.trans2)
|
||||
self.text = string.translate(self.text,self.transtable2)
|
||||
|
||||
self.index += 1
|
||||
l = string.split(self.text, None, 2)
|
||||
@ -552,7 +552,7 @@ class GedcomParser:
|
||||
return self.idswap[id]
|
||||
|
||||
def find_or_create_person(self,id):
|
||||
person = self.db.try_to_find_person_from_gramps_id(self.map_gid(id))
|
||||
person = self.db.find_person_from_gramps_id(self.map_gid(id),self.trans)
|
||||
return person
|
||||
|
||||
def parse_cause(self,event,level):
|
||||
|
Loading…
Reference in New Issue
Block a user