From: Mike Bayer Date: Tue, 1 Apr 2008 03:16:47 +0000 (+0000) Subject: - removed redundant get_history() method X-Git-Tag: rel_0_4_5~36 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b371c0c9dd6e615426b35f477288bc76474ca338;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - removed redundant get_history() method - the little bit at the bottom of _sort_circular_dependencies is absolutely covered by test/orm/cycles.py ! removing it breaks the test as run on PG. --- diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py index 5d2b21ddd0..152534d76f 100644 --- a/lib/sqlalchemy/orm/attributes.py +++ b/lib/sqlalchemy/orm/attributes.py @@ -495,14 +495,11 @@ class CollectionAttributeImpl(AttributeImpl): return [y for y in list(collections.collection_adapter(item))] def get_history(self, state, passive=False): - if self.key in state.dict: - return _create_history(self, state, state.dict[self.key]) + current = self.get(state, passive=passive) + if current is PASSIVE_NORESULT: + return (None, None, None) else: - current = self.get(state, passive=passive) - if current is PASSIVE_NORESULT: - return (None, None, None) - else: - return _create_history(self, state, current) + return _create_history(self, state, current) def fire_append_event(self, state, value, initiator): if self.key not in state.committed_state and self.key in state.dict: @@ -533,13 +530,6 @@ class CollectionAttributeImpl(AttributeImpl): for ext in self.extensions: ext.remove(instance, value, initiator or self) - def get_history(self, state, passive=False): - current = self.get(state, passive=passive) - if current is PASSIVE_NORESULT: - return (None, None, None) - else: - return _create_history(self, state, current) - def delete(self, state): if self.key not in state.dict: return diff --git a/lib/sqlalchemy/orm/unitofwork.py b/lib/sqlalchemy/orm/unitofwork.py index 1676eeb22c..66b68770d6 100644 --- a/lib/sqlalchemy/orm/unitofwork.py +++ b/lib/sqlalchemy/orm/unitofwork.py @@ -762,11 +762,11 @@ class UOWTask(object): make_task_tree(head, t, {}) ret = [t] + + # add tasks that were in the cycle, but didnt get assembled + # into the cyclical tree, to the start of the list for t2 in cycles: if t2 not in used_tasks and t2 is not self: - # add tasks that were in the cycle, but didnt get assembled - # into the cyclical tree, to the start of the list - # TODO: no test coverage for this !! localtask = UOWTask(self.uowtransaction, t2.mapper) for state in t2.elements: localtask.append(state, t2.listonly, isdelete=t2._objects[state].isdelete)