Commit 9c2414a7 authored by Jeffrey Shell's avatar Jeffrey Shell

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.
parent 541d1cb5
......@@ -55,7 +55,7 @@
'and' or 'or' tag, otherwise, no text is inserted.
'''
__rcs_id__='$Id: sqltest.py,v 1.16 2002/01/31 14:28:08 chrism Exp $'
__rcs_id__='$Id: sqltest.py,v 1.17 2002/08/09 17:58:33 jshell Exp $'
############################################################################
# Copyright
......@@ -65,7 +65,7 @@ __rcs_id__='$Id: sqltest.py,v 1.16 2002/01/31 14:28:08 chrism Exp $'
# rights reserved.
#
############################################################################
__version__='$Revision: 1.16 $'[11:-2]
__version__='$Revision: 1.17 $'[11:-2]
import sys
from DocumentTemplate.DT_Util import ParseError, parse_params, name_param
......@@ -180,7 +180,13 @@ class SQLTest:
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment