Mike Bayer avatar Mike Bayer committed cee2b2f

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

Comments (0)

Files changed (4)

lib/sqlalchemy/dialects/mysql/oursql.py

 
 class MySQLDialect_oursql(MySQLDialect):
     driver = 'oursql'
-# Py3K
-#    description_encoding = None
 # Py2K
     supports_unicode_binds = True
     supports_unicode_statements = True

lib/sqlalchemy/dialects/postgresql/pg8000.py

     execution_ctx_cls = PGExecutionContext_pg8000
     statement_compiler = PGCompiler_pg8000
     preparer = PGIdentifierPreparer_pg8000
+    description_encoding = 'use_encoding'
 
     colspecs = util.update_copy(
         PGDialect.colspecs,

lib/sqlalchemy/dialects/postgresql/psycopg2.py

 
 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

lib/sqlalchemy/engine/default.py

     #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
                                     )
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.