]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- [bug] Fixed bug where incorrect type information
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 17 Sep 2012 01:15:55 +0000 (21:15 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 17 Sep 2012 01:15:55 +0000 (21:15 -0400)
would be passed when the ORM would bind the
"version" column, when using the "version" feature.
Tests courtesy Daniel Miller.  [ticket:2539]

CHANGES
test/orm/test_versioning.py

diff --git a/CHANGES b/CHANGES
index 1c2208e0c0b7d9999aae3aa90253bffc58360ce4..1aac9a7110513ed9b0150a4638de6341200831ee 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -29,6 +29,11 @@ CHANGES
     class to the same target.  An informative
     error is raised now.
 
+  - [bug] Fixed bug where incorrect type information
+    would be passed when the ORM would bind the
+    "version" column, when using the "version" feature.
+    Tests courtesy Daniel Miller.  [ticket:2539]
+
 - sql
   - [bug] Fixed CTE bug whereby positional
     bound parameters present in the CTEs themselves
index 8d1f6d0148bec2a519a68f4831be9fde2fc34aa7..0faeb133decc03a7272a09a42be675ead4afd5be 100644 (file)
@@ -2,7 +2,7 @@ import datetime
 import sqlalchemy as sa
 from test.lib import engines, testing
 from sqlalchemy import Integer, String, Date, ForeignKey, literal_column, \
-    orm, exc, select
+    orm, exc, select, TypeDecorator
 from test.lib.schema import Table, Column
 from sqlalchemy.orm import mapper, relationship, Session, \
     create_session, column_property, sessionmaker,\
@@ -328,8 +328,14 @@ class ColumnTypeTest(fixtures.MappedTest):
 
     @classmethod
     def define_tables(cls, metadata):
+        class SpecialType(TypeDecorator):
+            impl = Date
+            def process_bind_param(self, value, dialect):
+                assert isinstance(value, datetime.date)
+                return value
+
         Table('version_table', metadata,
-              Column('id', Date, primary_key=True),
+              Column('id', SpecialType, primary_key=True),
               Column('version_id', Integer, nullable=False),
               Column('value', String(40), nullable=False))