summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-12-17 13:59:24 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2010-12-17 13:59:24 -0500
commitba964522e15da9062f5ed11e8bf55a0b5fb54693 (patch)
tree47f7b5ea8027bd47f9d57181ae3ff7bf5c6beba4 /lib/sqlalchemy/orm
parent0a6f79561517fb5a601ad18831aee70de2d14d00 (diff)
downloadsqlalchemy-ba964522e15da9062f5ed11e8bf55a0b5fb54693.tar.gz
- use get_all_pending in per_state_flush_actions(), but we'd like to
streamline get_history() in any case
Diffstat (limited to 'lib/sqlalchemy/orm')
-rw-r--r--lib/sqlalchemy/orm/attributes.py5
-rw-r--r--lib/sqlalchemy/orm/dependency.py11
-rw-r--r--lib/sqlalchemy/orm/unitofwork.py2
3 files changed, 12 insertions, 6 deletions
diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py
index e9f3763b1..e7ab4c3a1 100644
--- a/lib/sqlalchemy/orm/attributes.py
+++ b/lib/sqlalchemy/orm/attributes.py
@@ -663,6 +663,7 @@ class CollectionAttributeImpl(AttributeImpl):
if original is NO_VALUE:
return list(current)
else:
+ # TODO: use the dict() of state, obj here
current_set = util.IdentitySet(current)
original_set = util.IdentitySet(original)
@@ -1081,6 +1082,10 @@ def get_all_pending(state, dict_, key):
state,
key,
passive=PASSIVE_NO_INITIALIZE).sum()
+
+ TODO: we'd like to more closely merge the "history" tuple
+ generation with "get_all_pending()", making the presence
+ of the "History" object optional.
"""
diff --git a/lib/sqlalchemy/orm/dependency.py b/lib/sqlalchemy/orm/dependency.py
index ab8045f69..39ea1db35 100644
--- a/lib/sqlalchemy/orm/dependency.py
+++ b/lib/sqlalchemy/orm/dependency.py
@@ -152,10 +152,8 @@ class DependencyProcessor(object):
# detect if there's anything changed or loaded
# by a preprocessor on this state/attribute. if not,
# we should be able to skip it entirely.
- sum_ = uow.get_attribute_history(
- state,
- self.key,
- passive=True).sum()
+ sum_ = attributes.get_all_pending(state, state.dict, self.key)
+
if not sum_:
continue
@@ -177,9 +175,10 @@ class DependencyProcessor(object):
if child_in_cycles:
child_actions = []
- for child_state in sum_:
- if child_state is None:
+ for child in sum_:
+ if child is None:
continue
+ child_state = attributes.instance_state(child)
if child_state not in uow.states:
child_action = (None, None)
else:
diff --git a/lib/sqlalchemy/orm/unitofwork.py b/lib/sqlalchemy/orm/unitofwork.py
index ab62e5324..1e1eda4a3 100644
--- a/lib/sqlalchemy/orm/unitofwork.py
+++ b/lib/sqlalchemy/orm/unitofwork.py
@@ -166,6 +166,8 @@ class UOWTransaction(object):
self.attributes[hashkey] = (history, state_history, passive)
else:
impl = state.manager[key].impl
+ # TODO: store the history as (state, object) tuples
+ # so we don't have to keep converting here
history = impl.get_history(state, state.dict, passive=passive)
if history and impl.uses_objects:
state_history = history.as_state()