diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-12-15 21:23:01 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-12-15 21:23:01 -0500 |
| commit | b2223ab14988317f86fcbb6271a8b853b2924bae (patch) | |
| tree | 239be6387ea75ec09c70e4ca6524834a9521e142 /lib/sqlalchemy/sql | |
| parent | 638c1c46b23273e3c50638537ecfec91e839253e (diff) | |
| download | sqlalchemy-b2223ab14988317f86fcbb6271a8b853b2924bae.tar.gz | |
- add "force_nocheck" as a way to turn on unicode=force without even
doing the isinstance() check - currently used only by psycopg2 + native enum + py2k.
- didn't realize psycopg2 had UNICODEARRAY extension all this time; replace _PGArray
with just using UNICODEARRAY instead.
- replace unnecessary/inconsistent __import__ in _isolation_lookup.
Diffstat (limited to 'lib/sqlalchemy/sql')
| -rw-r--r-- | lib/sqlalchemy/sql/sqltypes.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/sqlalchemy/sql/sqltypes.py b/lib/sqlalchemy/sql/sqltypes.py index 1c475a28b..6ed20084b 100644 --- a/lib/sqlalchemy/sql/sqltypes.py +++ b/lib/sqlalchemy/sql/sqltypes.py @@ -192,13 +192,18 @@ class String(Concatenable, TypeEngine): wants_unicode = self.convert_unicode or dialect.convert_unicode needs_convert = wants_unicode and \ (dialect.returns_unicode_strings is not True or - self.convert_unicode == 'force') + self.convert_unicode in ('force', 'force_nocheck')) + needs_isinstance = ( + needs_convert and + dialect.returns_unicode_strings and + self.convert_unicode != 'force_nocheck' + ) if needs_convert: to_unicode = processors.to_unicode_processor_factory( dialect.encoding, self.unicode_error) - if dialect.returns_unicode_strings: + if needs_isinstance: # we wouldn't be here unless convert_unicode='force' # was specified, or the driver has erratic unicode-returning # habits. since we will be getting back unicode |
