diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-01-28 14:33:29 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-01-28 14:33:29 -0500 |
commit | 45e6875752fcaf7d3a60907959ed9d154cca0d5d (patch) | |
tree | 01b60b49435678cfd7d1e04b5aa5369f64b179fa /lib/sqlalchemy/orm/unitofwork.py | |
parent | 780cd9dce4b2d2c304512a237f2a3c1055542e75 (diff) | |
download | sqlalchemy-45e6875752fcaf7d3a60907959ed9d154cca0d5d.tar.gz |
- [bug] Fixed bug where "merge" cascade could
mis-interpret an unloaded attribute, if the
load_on_pending flag were used with
relationship(). Thanks to Kent Bower
for tests. [ticket:2374]
Diffstat (limited to 'lib/sqlalchemy/orm/unitofwork.py')
-rw-r--r-- | lib/sqlalchemy/orm/unitofwork.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/sqlalchemy/orm/unitofwork.py b/lib/sqlalchemy/orm/unitofwork.py index 757deffef..3cd0f15eb 100644 --- a/lib/sqlalchemy/orm/unitofwork.py +++ b/lib/sqlalchemy/orm/unitofwork.py @@ -66,7 +66,10 @@ def track_cascade_events(descriptor, prop): not sess._contains_state(newvalue_state): sess._save_or_update_state(newvalue_state) - if oldvalue is not None and prop.cascade.delete_orphan: + if oldvalue is not None and \ + oldvalue is not attributes.PASSIVE_NO_RESULT and \ + prop.cascade.delete_orphan: + # possible to reach here with attributes.NEVER_SET ? oldvalue_state = attributes.instance_state(oldvalue) if oldvalue_state in sess._new and \ |