Commit 128d07e9 authored by Aurel's avatar Aurel

fixup! c06cbf38 we were not checking value...

fixup! c06cbf38 we were not checking value before in case it is optional
parent 19be50b3
...@@ -48,7 +48,7 @@ if 1: # For easy diff with original (ZSQLMethods 3.14) ...@@ -48,7 +48,7 @@ if 1: # For easy diff with original (ZSQLMethods 3.14)
else: else:
v = str(int(v)) v = str(int(v))
except Exception: except Exception:
if not v and 'optional' in args and args['optional']: if 'optional' in args and args['optional']:
return 'null' return 'null'
err = 'Invalid integer value for <em>%s</em>' % name err = 'Invalid integer value for <em>%s</em>' % name
raise ValueError(err) raise ValueError(err)
...@@ -63,7 +63,7 @@ if 1: # For easy diff with original (ZSQLMethods 3.14) ...@@ -63,7 +63,7 @@ if 1: # For easy diff with original (ZSQLMethods 3.14)
# floats (on python2 only) # floats (on python2 only)
v = repr(float(v)) v = repr(float(v))
except Exception: except Exception:
if not v and 'optional' in args and args['optional']: if 'optional' in args and args['optional']:
return 'null' return 'null'
err = 'Invalid floating-point value for <em>%s</em>' % name err = 'Invalid floating-point value for <em>%s</em>' % name
raise ValueError(err) raise ValueError(err)
...@@ -85,7 +85,7 @@ if 1: # For easy diff with original (ZSQLMethods 3.14) ...@@ -85,7 +85,7 @@ if 1: # For easy diff with original (ZSQLMethods 3.14)
else: else:
if not isinstance(v, (str, StringTypes)): if not isinstance(v, (str, StringTypes)):
v = str(v) v = str(v)
if not v and t == 'nb': if t == 'nb':
if 'optional' in args and args['optional']: if 'optional' in args and args['optional']:
return 'null' return 'null'
else: else:
......
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