diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-01-07 18:52:02 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-01-07 18:52:02 +0000 |
| commit | e8feacf1db658ecccf7bb1d1688662e701ad37f5 (patch) | |
| tree | 9506104355f841bea36526cd6c66b4f5e21639e5 /lib/sqlalchemy | |
| parent | acd13f99f18ad02b2e51e8be7303124e40c55473 (diff) | |
| download | sqlalchemy-e8feacf1db658ecccf7bb1d1688662e701ad37f5.tar.gz | |
- fixed an attribute history bug whereby assigning a new collection
to a collection-based attribute which already had pending changes
would generate incorrect history [ticket:922]
- fixed delete-orphan cascade bug whereby setting the same
object twice to a scalar attribute could log it as an orphan
[ticket:925]
- generative select.order_by(None) / group_by(None) was not managing to
reset order by/group by criterion, fixed [ticket:924]
Diffstat (limited to 'lib/sqlalchemy')
| -rw-r--r-- | lib/sqlalchemy/orm/attributes.py | 8 | ||||
| -rw-r--r-- | lib/sqlalchemy/sql/expression.py | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py index a95ae0500..84c9dfbb6 100644 --- a/lib/sqlalchemy/orm/attributes.py +++ b/lib/sqlalchemy/orm/attributes.py @@ -251,8 +251,7 @@ class AttributeImpl(object): def set_committed_value(self, state, value): """set an attribute value on the given instance and 'commit' it.""" - if state.committed_state is not None: - state.commit_attr(self, value) + state.commit_attr(self, value) # remove per-instance callable, if any state.callables.pop(self.key, None) state.dict[self.key] = value @@ -395,7 +394,7 @@ class ScalarObjectAttributeImpl(ScalarAttributeImpl): if self.trackparent: if value is not None: self.sethasparent(value._state, True) - if previous is not None: + if previous is not value and previous is not None: self.sethasparent(previous._state, False) instance = state.obj() @@ -544,7 +543,8 @@ class CollectionAttributeImpl(AttributeImpl): if old is value: return - state.committed_state[self.key] = self.copy(old) + if self.key not in state.committed_state: + state.committed_state[self.key] = self.copy(old) old_collection = self.get_collection(state, old) diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py index b3b04b678..3dc7242d7 100644 --- a/lib/sqlalchemy/sql/expression.py +++ b/lib/sqlalchemy/sql/expression.py @@ -2815,7 +2815,7 @@ class _SelectBaseMixin(object): form of this method instead to prevent this issue. """ - if clauses == [None]: + if len(clauses) == 1 and clauses[0] is None: self._order_by_clause = ClauseList() else: if getattr(self, '_order_by_clause', None): @@ -2833,7 +2833,7 @@ class _SelectBaseMixin(object): form of this method instead to prevent this issue. """ - if clauses == [None]: + if len(clauses) == 1 and clauses[0] is None: self._group_by_clause = ClauseList() else: if getattr(self, '_group_by_clause', None): |
