]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Added a py3K conditional around unnecessary .decode()
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 13 Jan 2013 00:52:26 +0000 (19:52 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 13 Jan 2013 00:52:26 +0000 (19:52 -0500)
call in mssql information schema, fixes reflection
in Py3K. [ticket:2638]

doc/build/changelog/changelog_07.rst
lib/sqlalchemy/dialects/mssql/information_schema.py
test/dialect/test_mssql.py

index aebe92bc5e1e3d648dee13e300281cb7afbf3a02..cf802353aaeaaf652e1818aa90fd913a07be71c6 100644 (file)
       to the MSSQL dialect's "schema rendering"
       logic's failure to take .key into account.
 
+    .. change::
+        :tags: mssql, bug
+        :tickets: 2638
+
+      Added a Py3K conditional around unnecessary .decode()
+      call in mssql information schema, fixes reflection
+      in Py3k.
+
     .. change::
         :tags: orm, bug
         :tickets: 2650
index 53fcdb4eb0f233f2318acca3c9f4f44026b1e7f0..0dcddae977fd31fef444f773163c7ec820939e89 100644 (file)
@@ -15,8 +15,10 @@ class CoerceUnicode(TypeDecorator):
     impl = Unicode
 
     def process_bind_param(self, value, dialect):
+        # Py2K
         if isinstance(value, str):
             value = value.decode(dialect.encoding)
+        # end Py2K
         return value
 
 schemata = Table("SCHEMATA", ischema,
index 48d989d041326b8fa35a8ec1727a293223c4c760..41312de20f0943e77f10e282e8f9641e9b8b10f6 100644 (file)
@@ -1899,6 +1899,13 @@ class BinaryTest(fixtures.TestBase, AssertsExecutionResults):
         fp.close()
         return stream
 
+class InfoCoerceUnicodeTest(fixtures.TestBase):
+    def test_info_unicode_coercion(self):
+        from sqlalchemy.dialects.mssql.information_schema import CoerceUnicode
+
+        dialect = mssql.dialect()
+        value = CoerceUnicode().bind_processor(dialect)('a string')
+        assert isinstance(value, unicode)
 
 class ReflectHugeViewTest(fixtures.TestBase):
     __only_on__ = 'mssql'