Commit 0c189b9b authored by Christian Zagrodnick's avatar Christian Zagrodnick

- converting value only to str if it is neither str already or unicode. The

  underlying database adapter should convert a unicode to the encoding the
  database expects.
parent 69aa2e24
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
however, if x is ommitted or an empty string, then the value however, if x is ommitted or an empty string, then the value
inserted is 'null'. inserted is 'null'.
''' '''
__rcs_id__='$Id: sqlvar.py,v 1.13 2002/08/14 21:50:59 mj Exp $' __rcs_id__='$Id: sqlvar.py,v 1.14 2003/03/19 20:21:23 zagy Exp $'
############################################################################ ############################################################################
# Copyright # Copyright
...@@ -57,7 +57,7 @@ __rcs_id__='$Id: sqlvar.py,v 1.13 2002/08/14 21:50:59 mj Exp $' ...@@ -57,7 +57,7 @@ __rcs_id__='$Id: sqlvar.py,v 1.13 2002/08/14 21:50:59 mj Exp $'
# rights reserved. # rights reserved.
# #
############################################################################ ############################################################################
__version__='$Revision: 1.13 $'[11:-2] __version__='$Revision: 1.14 $'[11:-2]
from DocumentTemplate.DT_Util import ParseError, parse_params, name_param from DocumentTemplate.DT_Util import ParseError, parse_params, name_param
from string import find, split, join, atoi, atof from string import find, split, join, atoi, atof
...@@ -123,7 +123,8 @@ class SQLVar: ...@@ -123,7 +123,8 @@ class SQLVar:
raise ValueError, ( raise ValueError, (
'Invalid floating-point value for <em>%s</em>' % name) 'Invalid floating-point value for <em>%s</em>' % name)
else: else:
v=str(v) if not isinstance(v, (str, unicode)):
v=str(v)
if not v and t=='nb': if not v and t=='nb':
if args.has_key('optional') and args['optional']: if args.has_key('optional') and args['optional']:
return 'null' return 'null'
......
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