diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-05-09 18:43:05 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-05-09 18:43:05 +0000 |
| commit | 0bbb0e9b572929c05c5c0b3b0e22ffdeda29ad59 (patch) | |
| tree | 0d10f0da2fc8f0fe9acbfc2e6400084dcc653ca4 | |
| parent | 54296c962870821dfbe3c69b2eadd4e1c37e36db (diff) | |
| download | sqlalchemy-0bbb0e9b572929c05c5c0b3b0e22ffdeda29ad59.tar.gz | |
identified case where pending upon commit() is needed; since attribute rollback functionality is gone its safe to revert to this
| -rw-r--r-- | lib/sqlalchemy/orm/attributes.py | 1 | ||||
| -rw-r--r-- | test/orm/attributes.py | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py index 7ce825c9d..848810c13 100644 --- a/lib/sqlalchemy/orm/attributes.py +++ b/lib/sqlalchemy/orm/attributes.py @@ -964,6 +964,7 @@ class InstanceState(object): """ self.committed_state = {} + self.pending = {} # unexpire attributes which have loaded if self.expired_attributes: diff --git a/test/orm/attributes.py b/test/orm/attributes.py index 3883cdcd1..d31030f35 100644 --- a/test/orm/attributes.py +++ b/test/orm/attributes.py @@ -669,7 +669,20 @@ class PendingBackrefTest(TestBase): called[0] = 0 lazy_load = (p1, p2, p3) = [Post("post 1"), Post("post 2"), Post("post 3")] + + def test_commit_removes_pending(self): + global lazy_load + lazy_load = (p1, ) = [Post("post 1"), ] + called[0] = 0 + b = Blog("blog 1") + p1.blog = b + attributes.instance_state(b).commit_all() + attributes.instance_state(p1).commit_all() + assert b.posts == [Post("post 1")] + + + class HistoryTest(TestBase): def test_get_committed_value(self): class Foo(fixtures.Base): |
