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 ...@@ -27,6 +27,10 @@ Zope Changes
Features added 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 - Included Stefan Holek's ZopeTestCase 0.9
- The SiteErrorLog allows you to acknowledge (or delete) exceptions, - The SiteErrorLog allows you to acknowledge (or delete) exceptions,
......
...@@ -65,7 +65,7 @@ __rcs_id__='$Id$' ...@@ -65,7 +65,7 @@ __rcs_id__='$Id$'
# rights reserved. # rights reserved.
# #
############################################################################ ############################################################################
__version__='$Revision: 1.19 $'[11:-2] __version__='$Revision: 1.5 $'[11:-2]
import sys import sys
from DocumentTemplate.DT_Util import ParseError, parse_params, name_param from DocumentTemplate.DT_Util import ParseError, parse_params, name_param
...@@ -115,7 +115,6 @@ class SQLTest: ...@@ -115,7 +115,6 @@ class SQLTest:
self.op = op self.op = op
def render(self, md): def render(self, md):
name=self.__name__ name=self.__name__
t=self.type t=self.type
...@@ -159,6 +158,14 @@ class SQLTest: ...@@ -159,6 +158,14 @@ class SQLTest:
except ValueError: except ValueError:
raise ValueError, ( raise ValueError, (
'Invalid floating-point value for <em>%s</em>' % name) '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: else:
v=str(v) v=str(v)
v=md.getitem('sql_quote__',0)(v) v=md.getitem('sql_quote__',0)(v)
...@@ -173,6 +180,7 @@ class SQLTest: ...@@ -173,6 +180,7 @@ class SQLTest:
err = 'Invalid empty string value for <em>%s</em>' % name err = 'Invalid empty string value for <em>%s</em>' % name
raise ValueError, err raise ValueError, err
if not vs: if not vs:
if self.optional: return '' if self.optional: return ''
raise ValueError, ( 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