From: Mike Bayer Date: Mon, 17 Sep 2012 01:15:55 +0000 (-0400) Subject: - [bug] Fixed bug where incorrect type information X-Git-Tag: rel_0_7_9~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5049bf691225a11a142023873e75473cb0b68beb;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - [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] --- diff --git a/CHANGES b/CHANGES index 1c2208e0c0..1aac9a7110 100644 --- 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 diff --git a/test/orm/test_versioning.py b/test/orm/test_versioning.py index 8d1f6d0148..0faeb133de 100644 --- a/test/orm/test_versioning.py +++ b/test/orm/test_versioning.py @@ -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))