dabo Commit
Revision 5143
Date: 2009-03-23 06:27:52 -0700 (Mon, 23 Mar 2009)
Author: Pedro.Gato
Trac: http://trac.dabodev.com/changeset/5143

Changed:
U   trunk/dabo/lib/datanav/Page.py

Log:
Allow searching with tuples of int's, usefull for using dCheckListBox as search 
control

Diff:
Modified: trunk/dabo/lib/datanav/Page.py
===================================================================
--- trunk/dabo/lib/datanav/Page.py      2009-03-22 19:46:02 UTC (rev 5142)
+++ trunk/dabo/lib/datanav/Page.py      2009-03-23 13:27:52 UTC (rev 5143)
@@ -271,7 +271,11 @@
                                        matchVal = (opVal == _(CHOICE_TRUE))
                                else:
                                        matchVal = ctrl.Value
-                               matchStr = "%s" % matchVal
+                               try:
+                                       matchStr = "%s" % matchVal
+                               except TypeError:
+                                       matchStr = ""
+                               #matchStr = "%s" % matchVal
                                useStdFormat = True
 
                                if fldType in ("char", "memo"):
@@ -314,6 +318,15 @@
                                                opStr = ">"
 
                                elif fldType in ("int", "float"):
+                                       #PVG: if we have a int tuple, use all 
values
+                                       if isinstance(matchVal, tuple):
+                                               useStdFormat = False
+                                               whrMatches = []
+                                               for word in matchVal:
+                                                       mtch = {"table": table, 
"field": field, "value": word}
+                                                       whrMatches.append( 
biz.getWordMatchFormat() % mtch )
+                                               if len(whrMatches) > 0:
+                                                       whr = "(" + " or 
".join(whrMatches) + ")"
                                        if opVal.lower() in (_("equals"), 
_("is")):
                                                opStr = "="
                                        elif opVal.lower() == _("less 
than/equal to"):



_______________________________________________
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]

Reply via email to