dabo Commit
Revision 5833
Date: 2010-05-21 11:11:01 -0700 (Fri, 21 May 2010)
Author: Nate
Trac: http://trac.dabodev.com/changeset/5833
Changed:
U trunk/dabo/db/dCursorMixin.py
Log:
Discovered that we weren't re-keying mementos whenever a key value for a
compound primary key was changed. This fixes the problem.
Diff:
Modified: trunk/dabo/db/dCursorMixin.py
===================================================================
--- trunk/dabo/db/dCursorMixin.py 2010-05-21 18:10:04 UTC (rev 5832)
+++ trunk/dabo/db/dCursorMixin.py 2010-05-21 18:11:01 UTC (rev 5833)
@@ -1013,6 +1013,18 @@
if old_mem is not None:
self._mementos[keyFieldValue] =
old_mem
del self._mementos[old_val]
+ elif self._compoundKey and fld in keyField:
+ # Changing the value of one key field,
need to key the mementos on
+ # the new compound key value not the
old. Additionally, need
+ #to copy the mementos from the old key
value to the new one.
+ oldKeyFieldValue = tuple([rec[k] for k
in keyField])
+ old_mem =
self._mementos.get(oldKeyFieldValue, None)
+ keyFieldValue = list(oldKeyFieldValue)
+
keyFieldValue[list(keyField).index(fld)] = val
+ keyFieldValue = tuple(keyFieldValue)
+ if old_mem is not None:
+ self._mementos[keyFieldValue] =
old_mem
+ del
self._mementos[oldKeyFieldValue]
else:
if self._compoundKey:
keyFieldValue = tuple([rec[k]
for k in keyField])
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message:
http://leafe.com/archives/byMID/[email protected]