[Zope] A little sqltest patch: op=ne multiple

Shai Berger shai@aristocart.com
Wed, 31 Jan 2001 19:53:18 +0200


Hi guys,

The following trivial patch lets dtml-sqltest make sense
of multiple inequality tests, that is: Currently

	<dtml-sqltest name op="ne" multiple>

has the funny behavior of rendering

	name<>val

when passed a single value, and

	name in (val1,val2)

when a list is passed. With this fix, the latter case becomes

	name not in (val1,val2)

(It might be considered a good idea to take care of the other
ops too, but that would be non-trivial ;-)

Have fun,
	Shai.

*** sqltest.py  Wed Jan 31 19:42:15 2001
--- old_sqltest.py      Tue May 30 18:46:55 2000
***************
*** 222,229 ****
  
          if len(vs) > 1:
              vs=join(map(str,vs),', ')
-             if (self.op == comparison_operators['ne']):
-                 return "%s not in (%s)" % (self.column,vs)
              return "%s in (%s)" % (self.column,vs)
          return "%s %s %s" % (self.column, self.op, vs[0])
  
--- 222,227 ----