2007-09-29 James G. Sack <jgsack@san.rr.com>

* 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



svn: r9035
This commit is contained in:
Benny Malengier 2007-09-29 12:04:45 +00:00
parent 6df5468852
commit 213c6a9298
3 changed files with 23 additions and 16 deletions

View File

@ -1,3 +1,8 @@
2007-09-29 James G. Sack <jgsack@san.rr.com>
* 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
2007-09-28 James G. Sack <jgsack@san.rr.com>
* src/RecentFiles.py:
* src/GrampsDb/_GrampsDbBase.py:

View File

@ -44,7 +44,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"):
@ -58,7 +57,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

View File

@ -840,26 +840,30 @@ 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)
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)
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)
if self.db.find_event_from_handle(handle,self.trans) is not None:
self.db.event_bookmarks.append(handle)
print self.db.event_bookmarks.get()
elif target == 'source':
self.db.check_source_from_handle(handle,self.trans)
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)
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)
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)
if self.db.find_repository_from_handle(handle,self.trans) is not None:
self.db.repo_bookmarks.append(handle)
def start_format(self,attrs):