From b412615bd99000e143d90e74b6dcae4d6b638f55 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 14 Aug 2011 11:18:08 -0400 Subject: [PATCH] - Fixed regression in new composite rewrite where deferred=True option failed due to missing import [ticket:2253] --- CHANGES | 4 ++++ lib/sqlalchemy/orm/descriptor_props.py | 2 +- test/orm/test_composites.py | 14 +++++++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 485774dc27..5b504772d8 100644 --- a/CHANGES +++ b/CHANGES @@ -15,6 +15,10 @@ CHANGES when the Session.is_active is True. [ticket:2241] + - Fixed regression in new composite rewrite where + deferred=True option failed due to missing + import [ticket:2253] + - Fixed bug in query.join() which would occur in a complex multiple-overlapping path scenario, where the same table could be joined to diff --git a/lib/sqlalchemy/orm/descriptor_props.py b/lib/sqlalchemy/orm/descriptor_props.py index 311993c0d7..f43952279a 100644 --- a/lib/sqlalchemy/orm/descriptor_props.py +++ b/lib/sqlalchemy/orm/descriptor_props.py @@ -13,7 +13,7 @@ as actively in the load/persist ORM loop. from sqlalchemy.orm.interfaces import \ MapperProperty, PropComparator, StrategizedProperty from sqlalchemy.orm.mapper import _none_set -from sqlalchemy.orm import attributes +from sqlalchemy.orm import attributes, strategies from sqlalchemy import util, sql, exc as sa_exc, event, schema from sqlalchemy.sql import expression properties = util.importlater('sqlalchemy.orm', 'properties') diff --git a/test/orm/test_composites.py b/test/orm/test_composites.py index c336f40803..0d3cc20d63 100644 --- a/test/orm/test_composites.py +++ b/test/orm/test_composites.py @@ -621,4 +621,16 @@ class ConfigurationTest(fixtures.MappedTest): m.add_property('start', sa.orm.composite(Point, 'x1', 'y1')) m.add_property('end', sa.orm.composite(Point, 'x2', 'y2')) - self._test_roundtrip() \ No newline at end of file + self._test_roundtrip() + + def test_deferred(self): + edge, Edge, Point = (self.tables.edge, + self.classes.Edge, + self.classes.Point) + mapper(Edge, edge, properties={ + 'start':sa.orm.composite(Point, edge.c.x1, edge.c.y1, + deferred=True, group='s'), + 'end': sa.orm.composite(Point, edge.c.x2, edge.c.y2, + deferred=True) + }) + self._test_roundtrip() -- 2.47.3