[Zope-Checkins] CVS: Zope/lib/python/Shared/DC/ZRDB - sqltest.py:1.17

Jeffrey P Shell jeffrey@cuemedia.com
Fri, 9 Aug 2002 13:58:34 -0400


Update of /cvs-repository/Zope/lib/python/Shared/DC/ZRDB
In directory cvs.zope.org:/tmp/cvs-serv30441

Modified Files:
	sqltest.py 
Log Message:
Fix for collector issue 437: 

  dtml-sqltest now renders 'v not in (b,c)' when used as::

     <dtml-sqltest v type=... multiple op=ne>.  

  Previously, a sqltest for inequality would render 'v <> b' when a
  single value was submitted, but would render 'a in (b,c)' when
  multiple values were present and the 'multiple' switch was set.


=== Zope/lib/python/Shared/DC/ZRDB/sqltest.py 1.16 => 1.17 ===
--- Zope/lib/python/Shared/DC/ZRDB/sqltest.py:1.16	Thu Jan 31 09:28:08 2002
+++ Zope/lib/python/Shared/DC/ZRDB/sqltest.py	Fri Aug  9 13:58:33 2002
@@ -180,7 +180,13 @@
 
         if len(vs) > 1:
             vs=join(map(str,vs),', ')
-            return "%s in (%s)" % (self.column,vs)
+            if self.op == '<>':
+                ## Do the equivalent of 'not-equal' for a list,
+                ## "a not in (b,c)"
+                return "%s not in (%s)" % (self.column, vs)
+            else:
+                ## "a in (b,c)"
+                return "%s in (%s)" % (self.column, vs)
         return "%s %s %s" % (self.column, self.op, vs[0])
 
     __call__=render