From: Mike Bayer Date: Fri, 19 Nov 2010 23:44:09 +0000 (-0500) Subject: - active_history flag also added to composite(). X-Git-Tag: rel_0_7b1~255 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a9ed6f0a2a185abfe34ea0db6c7e9d83d55bda8e;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - active_history flag also added to composite(). The flag has no effect in 0.6, but is instead a placeholder flag for forwards compatibility, as it will be needed in 0.7 for composites. [ticket:1976] --- diff --git a/CHANGES b/CHANGES index 86fac65a2a..a551cfc28b 100644 --- a/CHANGES +++ b/CHANGES @@ -38,6 +38,12 @@ CHANGES always load the "old" value, so that it's available to attributes.get_history(). [ticket:1961] + - active_history flag also added to composite(). + The flag has no effect in 0.6, but is instead + a placeholder flag for forwards compatibility, + as it will be needed in 0.7 for composites. + [ticket:1976] + - sql - The 'info' attribute of Column is copied during Column.copy(), i.e. as occurs when using columns diff --git a/lib/sqlalchemy/orm/__init__.py b/lib/sqlalchemy/orm/__init__.py index b51142909d..94fbabc49b 100644 --- a/lib/sqlalchemy/orm/__init__.py +++ b/lib/sqlalchemy/orm/__init__.py @@ -648,6 +648,15 @@ def composite(class_, *cols, **kwargs): :param \*cols: List of Column objects to be mapped. + :param active_history=False: + When ``True``, indicates that the "previous" value for a + scalar attribute should be loaded when replaced, if not + already loaded. Note that attributes generated by + :func:`.composite` properties load the "previous" value + in any case, however this is being changed in 0.7, + so the flag is introduced here for forwards compatibility. + (new in 0.6.6) + :param group: A group name for this property when marked as deferred. diff --git a/test/orm/test_relationships.py b/test/orm/test_relationships.py index 03efa01832..555389a091 100644 --- a/test/orm/test_relationships.py +++ b/test/orm/test_relationships.py @@ -2410,7 +2410,8 @@ class ActiveHistoryFlagTest(_fixtures.FixtureTest): 'composite':composite( MyComposite, orders.c.description, - orders.c.isopen) + orders.c.isopen, + active_history=True) }) o1 = Order(composite=MyComposite('foo', 1)) self._test_attribute(o1, "composite", MyComposite('bar', 1))