1. Daniel Miller
  2. sqlalchemy

Commits

Mike Bayer  committed cee2b2f

- assume in py3k that description encoding is None unless the dialect really
overrides it
- psycopg2 + 3k supports unicode statements...

  • Participants
  • Parent commits db95534
  • Branches default

Comments (0)

Files changed (4)

File lib/sqlalchemy/dialects/mysql/oursql.py

View file
  • Ignore whitespace
 
 class MySQLDialect_oursql(MySQLDialect):
     driver = 'oursql'
-# Py3K
-#    description_encoding = None
 # Py2K
     supports_unicode_binds = True
     supports_unicode_statements = True

File lib/sqlalchemy/dialects/postgresql/pg8000.py

View file
  • Ignore whitespace
     execution_ctx_cls = PGExecutionContext_pg8000
     statement_compiler = PGCompiler_pg8000
     preparer = PGIdentifierPreparer_pg8000
+    description_encoding = 'use_encoding'
 
     colspecs = util.update_copy(
         PGDialect.colspecs,

File lib/sqlalchemy/dialects/postgresql/psycopg2.py

View file
  • Ignore whitespace
 
 class PGDialect_psycopg2(PGDialect):
     driver = 'psycopg2'
+    # Py2K
     supports_unicode_statements = False
+    # end Py2K
     default_paramstyle = 'pyformat'
     supports_sane_multi_rowcount = False
     execution_ctx_cls = PGExecutionContext_psycopg2

File lib/sqlalchemy/engine/default.py

View file
  • Ignore whitespace
     #supports_unicode_statements = True
     #supports_unicode_binds = True
     #returns_unicode_strings = True
+    #description_encoding = None
     # Py2K
     supports_unicode_statements = False
     supports_unicode_binds = False
     returns_unicode_strings = False
+    description_encoding = 'use_encoding'
     # end Py2K
 
 
                     (label_length, self.max_identifier_length))
         self.label_length = label_length
 
-        if not hasattr(self, 'description_encoding'):
-            self.description_encoding = getattr(
-                                            self, 
-                                            'description_encoding', 
-                                            encoding)
-
-        if self.description_encoding:
+        if self.description_encoding == 'use_encoding':
+            self._description_decoder = processors.to_unicode_processor_factory(
+                                            encoding
+                                    )
+        elif self.description_encoding is not None:
             self._description_decoder = processors.to_unicode_processor_factory(
                                             self.description_encoding
                                     )