Commits

Mike Bayer committed d2e6285

- more liberal check here
- dont encode enums in py3k

Comments (0)

Files changed (2)

lib/sqlalchemy/dialects/postgresql/psycopg2.py

 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):

test/sql/test_types.py

             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)