dabo Commit
Revision 6665
Date: 2011-07-04 09:05:42 -0700 (Mon, 04 Jul 2011)
Author: Ed
Trac: http://trac.dabodev.com/changeset/6665
Changed:
U trunk/dabo/ui/dDataControlMixinBase.py
Log:
Changed the logic for data binding with bizobjs. Now you can bind to any
attribute of the bizobj, not just columns in the bizobj's data set.
Diff:
Modified: trunk/dabo/ui/dDataControlMixinBase.py
===================================================================
--- trunk/dabo/ui/dDataControlMixinBase.py 2011-07-04 12:52:12 UTC (rev
6664)
+++ trunk/dabo/ui/dDataControlMixinBase.py 2011-07-04 16:05:42 UTC (rev
6665)
@@ -118,10 +118,12 @@
except (TypeError, dException.NoRecordsException):
self.Value = self.getBlankValue()
except dException.FieldNotFoundException:
- # See if DataField refers to a method of the
bizobj:
- method = getattr(src, self.DataField, None)
- if callable(method):
+ # See if DataField refers to an attribute of
the bizobj:
+ att = getattr(src, self.DataField, None)
+ if callable(att):
self.Value = method()
+ else:
+ self.Value = att
self._inDataUpdate = False
else:
if self._srcIsInstanceMethod is None and src is not
None:
@@ -232,11 +234,15 @@
try:
ret =
src.setFieldVal(self.DataField, curVal)
except
dException.FieldNotFoundException:
- # First see if
DataField refers to a method of the bizobj, in which
- # case it is read-only;
do not try to assign to it:
- method =
getattr(self.Source, self.DataField, None)
- if method is None:
+ # First see if
DataField refers to an attribute of the bizobj. If so, if it is
+ # a method, it is
read-only, so do not try to assign to it. Otherwise, set
+ # the attribute to the
value.
+ att =
getattr(self.Source, self.DataField, None)
+ if att is None:
raise
+ if callable(att):
+ return
+ setattr(self.Source,
self.DataField, curVal)
except
(dException.NoRecordsException, dException.RowNotFoundException):
# UI called
flushValue() when there wasn't a valid record active.
# Treat as spurious and
ignore.
_______________________________________________
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]