Commit ec1c7af2 authored by Jeffrey Shell's avatar Jeffrey Shell

if type was 'nb' and optional was set, ValueError was still being

raised.  fixed to return null
parent bc3a8a80
......@@ -119,7 +119,7 @@
however, if x is ommitted or an empty string, then the value
inserted is 'null'.
'''
__rcs_id__='$Id: sqlvar.py,v 1.6 1999/03/10 00:15:44 klm Exp $'
__rcs_id__='$Id: sqlvar.py,v 1.7 1999/03/25 13:31:04 jeffrey Exp $'
############################################################################
# Copyright
......@@ -129,7 +129,7 @@ __rcs_id__='$Id: sqlvar.py,v 1.6 1999/03/10 00:15:44 klm Exp $'
# rights reserved.
#
############################################################################
__version__='$Revision: 1.6 $'[11:-2]
__version__='$Revision: 1.7 $'[11:-2]
from DocumentTemplate.DT_Util import ParseError, parse_params, name_param
from string import find, split, join, atoi, atof
......@@ -188,8 +188,11 @@ class SQLVar:
else:
v=str(v)
if not v and t=='nb':
raise ValueError, (
'Invalid empty string value for <em>%s</em>' % name)
if args.has_key('optional') and args['optional']:
return 'null'
else:
raise ValueError, (
'Invalid empty string value for <em>%s</em>' % name)
v=md.getitem('sql_quote__',0)(v)
#if find(v,"\'") >= 0: v=join(split(v,"\'"),"''")
......
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