* src/GrampsDbUtils/_GedcomParse.py: Work around some Tracebacks

svn: r8155
This commit is contained in:
Martin Hawlisch 2007-02-18 19:30:32 +00:00
parent 9d4b8bbb59
commit 272b43b1f2
2 changed files with 23 additions and 3 deletions

View File

@ -1,3 +1,6 @@
2007-02-18 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/GrampsDbUtils/_GedcomParse.py: Work around some Tracebacks
2007-02-16 Zsolt Foldvari <zfoldvar@users.sourceforge.net> 2007-02-16 Zsolt Foldvari <zfoldvar@users.sourceforge.net>
* src/DisplayTabs/_NoteTab.py: accelerators replaced with key-press * src/DisplayTabs/_NoteTab.py: accelerators replaced with key-press
signal handler. signal handler.

View File

@ -792,6 +792,12 @@ class GedcomParser(UpdateCallback):
""" """
return self._find_from_handle(gramps_id, self.fid2id) return self._find_from_handle(gramps_id, self.fid2id)
def find_object_handle(self, gramps_id):
"""
Returns the database handle associated with the media object's GRAMPS ID
"""
return self._find_from_handle(gramps_id, self.oid2id)
def find_or_create_person(self, gramps_id): def find_or_create_person(self, gramps_id):
""" """
Finds or creates a person based on the GRAMPS ID. If the ID is Finds or creates a person based on the GRAMPS ID. If the ID is
@ -924,8 +930,12 @@ class GedcomParser(UpdateCallback):
fullname = fullname.replace('\\', os.path.sep) fullname = fullname.replace('\\', os.path.sep)
tries.append(fullname) tries.append(fullname)
try:
if os.path.isfile(fullname): if os.path.isfile(fullname):
return (1, fullname) return (1, fullname)
except UnicodeEncodeError:
# FIXME: problem possibly caused by umlaut/accented character in filename
return (0, tries)
other = os.path.join(altpath, fullname) other = os.path.join(altpath, fullname)
tries.append(other) tries.append(other)
if os.path.isfile(other): if os.path.isfile(other):
@ -2718,6 +2728,13 @@ class GedcomParser(UpdateCallback):
break break
else: else:
func = func_map.get(line.token, self.func_event_undef) func = func_map.get(line.token, self.func_event_undef)
if func.__name__ == "func_ignore":
# FIXME: in some cases the returned handler is func_ignore instead of func_event_ignore
# but those two require different arguments passed
state = GedcomUtils.CurrentState()
state.level = level
func(line, state)
else:
func(line, event_ref, event, level+1) func(line, event_ref, event, level+1)
def func_event_ignore(self, line, event_ref, event, level): def func_event_ignore(self, line, event_ref, event, level):