]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- active_history flag also added to composite().
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 19 Nov 2010 23:44:09 +0000 (18:44 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 19 Nov 2010 23:44:09 +0000 (18:44 -0500)
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]

CHANGES
lib/sqlalchemy/orm/__init__.py
test/orm/test_relationships.py

diff --git a/CHANGES b/CHANGES
index 86fac65a2a614b0cd6602e31085670f686655ff2..a551cfc28bbca0eea0c12f818bc1cfee16d8b21d 100644 (file)
--- 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
index b51142909dc2cdf2be8676098eaa5496221a1f4c..94fbabc49b7b047753a0d0f97dd38bfd27af76bc 100644 (file)
@@ -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.
 
index 03efa01832f1b6cb0d20dcafcc6709de5c9cb813..555389a09126e80e87df6dea37d084695f9ba971 100644 (file)
@@ -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))