* src/plugins/ImportGeneWeb.py: Start parsing titles of a person

svn: r7604
This commit is contained in:
Martin Hawlisch 2006-11-10 15:54:51 +00:00
parent 49199f9c12
commit df76108793
2 changed files with 27 additions and 1 deletions

View File

@ -1,3 +1,6 @@
2006-11-10 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/plugins/ImportGeneWeb.py: Start parsing titles of a person
2006-11-09 Alex Roitman <shura@gramps-project.org>
* src/Filters/Rules/Person/_HasDeath.py (apply): Match any of the
death events.

View File

@ -553,7 +553,30 @@ class GeneWebParser:
firstname_aliases.append(self.decode(fields[idx][1:-1]))
idx += 1
elif fields[idx][0] == '[':
print "TODO: Titles: %s" % fields[idx]
self.debug("Title: %s" % fields[idx])
titleparts = self.decode(fields[idx][1:-1]).split(":")
tname = ttitle = tplace = tstart = tend = tnth = None
try:
tname = titleparts[0]
ttitle = titleparts[1]
if( titleparts[2]):
tplace = self.get_or_create_place(titleparts[2])
tstart = self.parse_date(titleparts[3])
tend = self.parse_date(titleparts[4])
tnth = titleparts[5]
except IndexError: # not all parts are written all the time
pass
if tnth: # Append title numer to title
ttitle = "%s, %s" % (ttitle, tnth)
title = self.create_event(RelLib.EventType.NOB_TITLE,ttitle,tstart,tplace)
# TODO: Geneweb has a start date and an end date, and therefore
# supprts stuff like: FROM about 1955 TO between 1998 and 1999
# gramps only supports one single date ore range.
if tname and tname != "*":
title.set_note( tname)
title_ref = RelLib.EventRef()
title_ref.set_reference_handle(title.get_handle())
person.add_event_ref(title_ref)
idx += 1
elif fields[idx] == '#nick':
idx += 1