From: Mike Bayer Date: Fri, 8 Apr 2011 18:54:45 +0000 (-0400) Subject: - assume in py3k that description encoding is None unless the dialect really X-Git-Tag: rel_0_7b4~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ee542a109feba61cc34adc7927b74500894c9425;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - assume in py3k that description encoding is None unless the dialect really overrides it - psycopg2 + 3k supports unicode statements... --- diff --git a/lib/sqlalchemy/dialects/mysql/oursql.py b/lib/sqlalchemy/dialects/mysql/oursql.py index ff5ecfc931..4ea4f56bed 100644 --- a/lib/sqlalchemy/dialects/mysql/oursql.py +++ b/lib/sqlalchemy/dialects/mysql/oursql.py @@ -64,8 +64,6 @@ class MySQLExecutionContext_oursql(MySQLExecutionContext): class MySQLDialect_oursql(MySQLDialect): driver = 'oursql' -# Py3K -# description_encoding = None # Py2K supports_unicode_binds = True supports_unicode_statements = True diff --git a/lib/sqlalchemy/dialects/postgresql/pg8000.py b/lib/sqlalchemy/dialects/postgresql/pg8000.py index c4f00eabea..44e095cdd9 100644 --- a/lib/sqlalchemy/dialects/postgresql/pg8000.py +++ b/lib/sqlalchemy/dialects/postgresql/pg8000.py @@ -89,6 +89,7 @@ class PGDialect_pg8000(PGDialect): execution_ctx_cls = PGExecutionContext_pg8000 statement_compiler = PGCompiler_pg8000 preparer = PGIdentifierPreparer_pg8000 + description_encoding = 'use_encoding' colspecs = util.update_copy( PGDialect.colspecs, diff --git a/lib/sqlalchemy/dialects/postgresql/psycopg2.py b/lib/sqlalchemy/dialects/postgresql/psycopg2.py index 10d6e02697..f96dab9a4a 100644 --- a/lib/sqlalchemy/dialects/postgresql/psycopg2.py +++ b/lib/sqlalchemy/dialects/postgresql/psycopg2.py @@ -221,7 +221,9 @@ class PGIdentifierPreparer_psycopg2(PGIdentifierPreparer): 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 diff --git a/lib/sqlalchemy/engine/default.py b/lib/sqlalchemy/engine/default.py index 75a6864753..9f6c5010e2 100644 --- a/lib/sqlalchemy/engine/default.py +++ b/lib/sqlalchemy/engine/default.py @@ -56,10 +56,12 @@ class DefaultDialect(base.Dialect): #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 @@ -139,13 +141,11 @@ class DefaultDialect(base.Dialect): (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 )