diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-11-25 23:46:05 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-11-25 23:46:05 +0000 |
| commit | 168bab1cf19c71b55e53e5ed07def2ebe61332f6 (patch) | |
| tree | c8f03c63b9031e2ff14453eef49c3934b48561a6 /lib | |
| parent | 6753cb7f72be3fa92fa986ddb185e164af78c6dc (diff) | |
| download | sqlalchemy-168bab1cf19c71b55e53e5ed07def2ebe61332f6.tar.gz | |
- check for NoneType too with unicode....
- fixed ORM tests to have proper unicode
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sqlalchemy/types.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/sqlalchemy/types.py b/lib/sqlalchemy/types.py index ac9a36195..93e7d6066 100644 --- a/lib/sqlalchemy/types.py +++ b/lib/sqlalchemy/types.py @@ -18,6 +18,7 @@ import datetime as dt from sqlalchemy import exceptions from sqlalchemy.util import pickle, Decimal as _python_Decimal +NoneType = type(None) class _UserTypeAdapter(type): """adapts 0.3 style user-defined types with convert_bind_param/convert_result_value @@ -319,7 +320,7 @@ class String(Concatenable, TypeEngine): def process(value): if isinstance(value, unicode): return value.encode(dialect.encoding) - elif assert_unicode: + elif assert_unicode and not isinstance(value, (unicode, NoneType)): raise exceptions.InvalidRequestError("Received non-unicode bind param value %r" % value) else: return value |
