2007-09-29 Benny Malengier <benny.malengier@gramps-project.org>
* src/GrampsDb/_ReadXML.py: remove bug: no more creation of objects if bookmark is found with handle that is not in database. This causes corruption of database! * src/GrampsDb/_GrampsDbBase.py: person bookmarks do not work after save. Correct. Issue #1260 Part 1 of thumbnail changes svn: r9038
This commit is contained in:
@@ -47,7 +47,6 @@ class GrampsXMLDB(GrampsInMemDB):
|
||||
def __init__(self, use_txn = True):
|
||||
"""creates a new GrampsDB"""
|
||||
GrampsInMemDB.__init__(self)
|
||||
self.bookmarks = GrampsDbBookmarks()
|
||||
|
||||
def load(self, name, callback, mode="w"):
|
||||
|
||||
@@ -67,7 +66,6 @@ class GrampsXMLDB(GrampsInMemDB):
|
||||
except OSError, IOError:
|
||||
return 1
|
||||
|
||||
self.bookmarks.set(self.metadata.get('bookmarks',[]))
|
||||
self.db_is_open = True
|
||||
self.abort_possible = True
|
||||
return 1
|
||||
|
||||
@@ -875,30 +875,33 @@ class GrampsParser(UpdateCallback):
|
||||
|
||||
# This is new XML, so we are guaranteed to have a handle ref
|
||||
handle = attrs['hlink'].replace('_', '')
|
||||
# Due to pre 2.2.9 bug, bookmarks might be handle of other object
|
||||
# Make sure those are filtered out.
|
||||
# Bookmarks are at end, so all handle must exist before we do bookmrks
|
||||
if target == 'person':
|
||||
self.db.check_person_from_handle(handle, self.trans)
|
||||
self.db.bookmarks.append(handle)
|
||||
if self.db.find_person_from_handle(handle,self.trans) is not None:
|
||||
self.db.bookmarks.append(handle)
|
||||
elif target == 'family':
|
||||
self.db.check_family_from_handle(handle, self.trans)
|
||||
self.db.family_bookmarks.append(handle)
|
||||
if self.db.find_family_from_handle(handle,self.trans) is not None:
|
||||
self.db.family_bookmarks.append(handle)
|
||||
elif target == 'event':
|
||||
self.db.check_event_from_handle(handle, self.trans)
|
||||
self.db.event_bookmarks.append(handle)
|
||||
if self.db.find_event_from_handle(handle,self.trans) is not None:
|
||||
self.db.event_bookmarks.append(handle)
|
||||
elif target == 'source':
|
||||
self.db.check_source_from_handle(handle, self.trans)
|
||||
self.db.source_bookmarks.append(handle)
|
||||
if self.db.find_source_from_handle(handle,self.trans) is not None:
|
||||
self.db.source_bookmarks.append(handle)
|
||||
elif target == 'place':
|
||||
self.db.check_place_from_handle(handle, self.trans)
|
||||
self.db.place_bookmarks.append(handle)
|
||||
if self.db.find_place_from_handle(handle,self.trans) is not None:
|
||||
self.db.place_bookmarks.append(handle)
|
||||
elif target == 'media':
|
||||
self.db.check_object_from_handle(handle, self.trans)
|
||||
self.db.media_bookmarks.append(handle)
|
||||
if self.db.find_object_from_handle(handle,self.trans) is not None:
|
||||
self.db.media_bookmarks.append(handle)
|
||||
elif target == 'repository':
|
||||
self.db.check_repository_from_handle(handle, self.trans)
|
||||
self.db.repo_bookmarks.append(handle)
|
||||
if self.db.find_repository_from_handle(handle,self.trans) is not None:
|
||||
self.db.repo_bookmarks.append(handle)
|
||||
elif target == 'note':
|
||||
self.db.check_note_from_handle(handle, self.trans)
|
||||
self.db.note_bookmarks.append(handle)
|
||||
if self.db.find_note_from_handle(handle, self.trans) is not None:
|
||||
self.db.note_bookmarks.append(handle)
|
||||
|
||||
def start_format(self, attrs):
|
||||
number = int(attrs['number'])
|
||||
|
||||
Reference in New Issue
Block a user