make ref update optional
svn: r5780
This commit is contained in:
parent
fd2d95fcc2
commit
90247368d9
@ -1,3 +1,6 @@
|
||||
2006-01-17 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
|
||||
* src/GrampsDb/_GrampsBSDDB.py: make ref update optional
|
||||
|
||||
2006-01-17 Alex Roitman <shura@gramps-project.org>
|
||||
* src/GrampsDb/_GrampsDbBase.py (redo): Properly abort redo action
|
||||
when no redo is available.
|
||||
|
@ -586,10 +586,16 @@ class GrampsBSDDB(GrampsDbBase):
|
||||
|
||||
primary_cur.close()
|
||||
|
||||
def _update_reference_map(self, obj, transaction):
|
||||
def _update_reference_map(self, obj, transaction, update=True):
|
||||
"""
|
||||
If update = True old references are cleaned up and only new references are added
|
||||
if update = False then it is assumed that the object is not already referenced.
|
||||
"""
|
||||
|
||||
# Add references to the reference_map for all primary object referenced
|
||||
# from the primary object 'obj' or any of its secondary objects.
|
||||
|
||||
if update:
|
||||
# FIXME: this needs to be properly integrated into the transaction
|
||||
# framework so that the reference_map changes are part of the
|
||||
# transaction
|
||||
@ -640,6 +646,9 @@ class GrampsBSDDB(GrampsDbBase):
|
||||
|
||||
new_references = current_references.difference(existing_references)
|
||||
|
||||
else:
|
||||
new_references = set(obj.get_referenced_handles_recursively())
|
||||
|
||||
# handle addition of new references
|
||||
|
||||
if len(new_references) > 0:
|
||||
@ -647,12 +656,8 @@ class GrampsBSDDB(GrampsDbBase):
|
||||
data = ((CLASS_TO_KEY_MAP[obj.__class__.__name__],handle),
|
||||
(CLASS_TO_KEY_MAP[ref_class_name],ref_handle),)
|
||||
self._add_reference((handle,ref_handle),data,transaction)
|
||||
#self.reference_map.put(
|
||||
# str((handle,ref_handle),),
|
||||
# ((CLASS_TO_KEY_MAP[obj.__class__.__name__],handle),
|
||||
# (CLASS_TO_KEY_MAP[ref_class_name],ref_handle),),
|
||||
# txn=self.txn)
|
||||
|
||||
if update:
|
||||
# handle deletion of old references
|
||||
if len(no_longer_required_references) > 0:
|
||||
for (ref_class_name,ref_handle) in no_longer_required_references:
|
||||
|
@ -7,7 +7,7 @@ import time
|
||||
import traceback
|
||||
import sys
|
||||
|
||||
sys.path.append('../src')
|
||||
sys.path.append('../../src')
|
||||
|
||||
try:
|
||||
set()
|
||||
|
Loading…
Reference in New Issue
Block a user