summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2011-04-08 15:16:12 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2011-04-08 15:16:12 -0400
commitdf3bf65f12e134db9f13fa66010969dda96d2249 (patch)
tree985aceea87fe8870b9e07d56d86f73f5e5f9d9cd
parentee542a109feba61cc34adc7927b74500894c9425 (diff)
downloadsqlalchemy-df3bf65f12e134db9f13fa66010969dda96d2249.tar.gz
- more liberal check here
- dont encode enums in py3k
-rw-r--r--lib/sqlalchemy/dialects/postgresql/psycopg2.py2
-rw-r--r--test/sql/test_types.py2
2 files changed, 3 insertions, 1 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/psycopg2.py b/lib/sqlalchemy/dialects/postgresql/psycopg2.py
index f96dab9a4..d840a0d1e 100644
--- a/lib/sqlalchemy/dialects/postgresql/psycopg2.py
+++ b/lib/sqlalchemy/dialects/postgresql/psycopg2.py
@@ -142,8 +142,10 @@ class _PGNumeric(sqltypes.Numeric):
class _PGEnum(ENUM):
def __init__(self, *arg, **kw):
super(_PGEnum, self).__init__(*arg, **kw)
+ # Py2K
if self.convert_unicode:
self.convert_unicode = "force"
+ # end Py2K
class _PGArray(ARRAY):
def __init__(self, *arg, **kw):
diff --git a/test/sql/test_types.py b/test/sql/test_types.py
index 7865a5296..d44487d53 100644
--- a/test/sql/test_types.py
+++ b/test/sql/test_types.py
@@ -635,7 +635,7 @@ class UnicodeTest(fixtures.TestBase, AssertsExecutionResults):
row = engine.execute(utf8_table.select()).first()
x = row['plain_varchar_no_coding_error']
connect_opts = engine.dialect.create_connect_args(testing.db.url)[1]
- if connect_opts.get('use_unicode', False):
+ if isinstance(x, unicode):
x = x.encode('utf-8')
a = hexlify(x)
b = hexlify(asciidata)