dabo Commit
Revision 7055
Date: 2012-01-19 13:15:28 -0800 (Thu, 19 Jan 2012)
Author: Jacekk
Trac: http://trac.dabodev.com/changeset/7055
Changed:
U trunk/dabo/ui/dDataControlMixinBase.py
Log:
Added some checks to prevent the flushValue() method recursive call if data
source is bound to widget property.
Diff:
Modified: trunk/dabo/ui/dDataControlMixinBase.py
===================================================================
--- trunk/dabo/ui/dDataControlMixinBase.py 2012-01-13 23:46:50 UTC (rev
7054)
+++ trunk/dabo/ui/dDataControlMixinBase.py 2012-01-19 21:15:28 UTC (rev
7055)
@@ -213,6 +213,8 @@
Save any changes to the underlying source field. First check to
make sure
that any changes are validated.
"""
+ if getattr(self, "_from_flushValue", False):
+ return True
# We need to test empty oldvals because of the way that
textboxes work; they
# can set _oldVal to "" before the actual Value is set.
if (not self._oldVal) or (self._oldVal != self.Value):
@@ -246,6 +248,10 @@
isChanged = (abs(curVal - oldVal) > 0.0000001)
else:
isChanged = (curVal != oldVal)
+ # In some situations, e.g. if control is bound to widget
property, changes of property
+ # value can cause recursive call to the flushValue() method.
+ # To prevent such situation we have to check the
_from_flushValue attribute at the beginning.
+ self._from_flushValue = True
if isChanged:
if not self._DesignerMode:
if (self.DataSource or
isinstance(self.DataSource, dabo.dPref)) and self.DataField:
@@ -292,7 +298,6 @@
nm =
ustr(self.DataSource)
dabo.log.error("Could not bind to '%s.%s'\nReason: %s" % (nm, self.DataField,
e))
self._oldVal = curVal
- self._from_flushValue = True
self._afterValueChanged()
self._from_flushValue = False
# Raise an event so that user code can react if needed:
_______________________________________________
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]