Commit 7f35a2c8 authored by Andreas Jung's avatar Andreas Jung

- ZSQL methods: added workaround for a problem where a 'string' argument

       variable was included into the generated query if the 'optional' flag inside
       dtml-sqltest was set an if the value of the string was empty.
parent 87b92f4a
......@@ -27,6 +27,10 @@ Zope Changes
Features added
- ZSQL methods: added workaround for a problem where a 'string' argument
variable was included into the generated query if the 'optional' flag inside
dtml-sqltest was set an if the value of the string was empty.
- Included Stefan Holek's ZopeTestCase 0.9
- The SiteErrorLog allows you to acknowledge (or delete) exceptions,
......
......@@ -65,7 +65,7 @@ __rcs_id__='$Id$'
# rights reserved.
#
############################################################################
__version__='$Revision: 1.19 $'[11:-2]
__version__='$Revision: 1.5 $'[11:-2]
import sys
from DocumentTemplate.DT_Util import ParseError, parse_params, name_param
......@@ -115,7 +115,6 @@ class SQLTest:
self.op = op
def render(self, md):
name=self.__name__
t=self.type
......@@ -159,6 +158,14 @@ class SQLTest:
except ValueError:
raise ValueError, (
'Invalid floating-point value for <em>%s</em>' % name)
## ZSQL methods: added workaround for a problem where a 'string' argument
## variable was included into the generated query if the 'optional' flag inside
## dtml-sqltest was set an if the value of the string was empty.
elif t=='string' and len(str(v)) == 0 and args.get('optional', 0):
continue
else:
v=str(v)
v=md.getitem('sql_quote__',0)(v)
......@@ -173,6 +180,7 @@ class SQLTest:
err = 'Invalid empty string value for <em>%s</em>' % name
raise ValueError, err
if not vs:
if self.optional: return ''
raise ValueError, (
......
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