dabo Commit
Revision 3098
Date: 2007-05-01 18:06:36 -0700 (Tue, 01 May 2007)
Author: Ed
Trac: http://svn.dabodev.com/trac/dabo/changeset/3098

Changed:
U   trunk/dabo/ui/uiwx/dPemMixin.py

Log:
Added the option of passing complex filter expressions to setAll(). This 
function now accepts a tuple of filter expressions of the format 'att comp 
val', which will be eval'd with the child objects inn order to determine if the 
filter applies. Each expression in the tuple is ANDed with the others; all the 
tuple elements must evaluate to True for the value to be set.


Diff:
Modified: trunk/dabo/ui/uiwx/dPemMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dPemMixin.py     2007-04-30 19:09:04 UTC (rev 3097)
+++ trunk/dabo/ui/uiwx/dPemMixin.py     2007-05-02 01:06:36 UTC (rev 3098)
@@ -1015,11 +1015,19 @@
                        kids = self.Children
                if not kids:
                        return
+               if isinstance(filt, basestring):
+                       filt = (filt, )
                for kid in kids:
                        ok = hasattr(kid, prop)
                        if ok:
                                if filt:
-                                       ok = eval("kid.%s" % filt)
+                                       for ff in filt:
+                                               try:
+                                                       ok = eval("kid.%s" % ff)
+                                               except AttributeError:
+                                                       ok = False
+                                               if not ok:
+                                                       break                   
                                
                        if ok:
                                setattr(kid, prop, val)
                        if recurse:




_______________________________________________
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/dabo-dev/[EMAIL PROTECTED]

Reply via email to