dabo Commit
Revision 6420
Date: 2011-02-11 05:40:58 -0800 (Fri, 11 Feb 2011)
Author: Jacekk
Trac: http://trac.dabodev.com/changeset/6420
Changed:
U trunk/dabo/biz/dBizobj.py
Log:
Added update for child cursor key to new vale on saving new rows to avoid
redundant requeries.
Diff:
Modified: trunk/dabo/biz/dBizobj.py
===================================================================
--- trunk/dabo/biz/dBizobj.py 2011-02-10 17:36:02 UTC (rev 6419)
+++ trunk/dabo/biz/dBizobj.py 2011-02-11 13:40:58 UTC (rev 6420)
@@ -1463,9 +1463,7 @@
# identified until the record is saved and a permanent
PK is obtained.
tmpKey = cursor.genTempAutoPK()
if currKey is None:
- self.__currentCursorKey = tmpKey
- del self.__cursors[currKey]
- self.__cursors[tmpKey] = cursor
+ self._updateCursorKey(tmpKey)
if setDefaults:
cursor.setDefaults(self.DefaultValues)
cursor.setNewFlag()
@@ -1499,6 +1497,8 @@
if self.LinkField:
if val is None:
val = self.getParentLinkValue()
+ # Update cursor key to avoid future redundant requery.
+ self._updateCursorKey(val)
self.scan(self._setParentFK, val)
def _setParentFK(self, val):
@@ -2132,6 +2132,18 @@
return self.__cursors
+ def _updateCursorKey(self, newKey):
+ """For internal use only! Should never be called from a
developer's code.
+ Handles current cursor key value changes.
+ """
+ oldKey = self.__currentCursorKey
+ if newKey <> oldKey:
+ cursor = self._CurrentCursor
+ self.__currentCursorKey = newKey
+ del self.__cursors[oldKey]
+ self.__cursors[newKey] = cursor
+
+
## Property getter/setter methods ##
def _getAutoPopulatePK(self):
try:
_______________________________________________
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]