summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-11-19 18:44:09 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2010-11-19 18:44:09 -0500
commita9ed6f0a2a185abfe34ea0db6c7e9d83d55bda8e (patch)
tree502bf1e71ce2bf115d1e0a9dc36588144f4915e1
parente15fa0342d2ac83414c563abd8fd478251d4d35f (diff)
downloadsqlalchemy-a9ed6f0a2a185abfe34ea0db6c7e9d83d55bda8e.tar.gz
- 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]
-rw-r--r--CHANGES6
-rw-r--r--lib/sqlalchemy/orm/__init__.py9
-rw-r--r--test/orm/test_relationships.py3
3 files changed, 17 insertions, 1 deletions
diff --git a/CHANGES b/CHANGES
index 86fac65a2..a551cfc28 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 b51142909..94fbabc49 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 03efa0183..555389a09 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))