diff options
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r-- | lib/sqlalchemy/orm/dependency.py | 27 | ||||
-rw-r--r-- | lib/sqlalchemy/orm/unitofwork.py | 21 | ||||
-rw-r--r-- | lib/sqlalchemy/test/assertsql.py | 15 | ||||
-rw-r--r-- | lib/sqlalchemy/topological.py | 3 |
4 files changed, 33 insertions, 33 deletions
diff --git a/lib/sqlalchemy/orm/dependency.py b/lib/sqlalchemy/orm/dependency.py index 1018c2029..d02776dce 100644 --- a/lib/sqlalchemy/orm/dependency.py +++ b/lib/sqlalchemy/orm/dependency.py @@ -110,7 +110,8 @@ class DependencyProcessor(object): """ if self.post_update and self._check_reverse(uow): - return + # TODO: coverage here + return iter([]) # locate and disable the aggregate processors # for this dependency @@ -684,7 +685,8 @@ class DetectKeySwitch(DependencyProcessor): ]) def per_state_flush_actions(self, uow, states, isdelete): - pass + # TODO: coverage here + return iter([]) def presort_deletes(self, uowcommit, states): assert False @@ -741,9 +743,9 @@ class ManyToManyDP(DependencyProcessor): def per_state_flush_actions(self, uow, states, isdelete): if self._check_reverse(uow): - return + return iter([]) else: - DependencyProcessor.\ + return DependencyProcessor.\ per_state_flush_actions(self, uow, states, isdelete) def per_property_dependencies(self, uow, parent_saves, @@ -777,15 +779,20 @@ class ManyToManyDP(DependencyProcessor): after_save, before_delete, isdelete, childisdelete): if not isdelete: - uow.dependencies.update([ - (save_parent, after_save), - (after_save, child_action), - (save_parent, child_action) - ]) + if childisdelete: + uow.dependencies.update([ + (save_parent, after_save), + (after_save, child_action), + ]) + else: + uow.dependencies.update([ + (save_parent, after_save), + (child_action, after_save), + ]) else: uow.dependencies.update([ (before_delete, child_action), - (child_action, delete_parent) + (before_delete, delete_parent) ]) def presort_deletes(self, uowcommit, states): diff --git a/lib/sqlalchemy/orm/unitofwork.py b/lib/sqlalchemy/orm/unitofwork.py index ca8c31e86..85ed790d9 100644 --- a/lib/sqlalchemy/orm/unitofwork.py +++ b/lib/sqlalchemy/orm/unitofwork.py @@ -4,19 +4,11 @@ # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php -"""The internals for the Unit Of Work system. +"""The internals for the unit of work system. -Includes hooks into the attributes package enabling the routing of -change events to Unit Of Work objects, as well as the flush() -mechanism which creates a dependency structure that executes change -operations. - -A Unit of Work is essentially a system of maintaining a graph of -in-memory objects and their modified state. Objects are maintained as -unique against their primary key identity using an *identity map* -pattern. The Unit of Work then maintains lists of objects that are -new, dirty, or deleted and provides the capability to flush all those -changes at once. +The session's flush() process passes objects to a contextual object +here, which assembles flush tasks based on mappers and their properties, +organizes them in order of dependency, and executes. """ @@ -79,11 +71,6 @@ class UOWEventHandler(interfaces.AttributeExtension): class UOWTransaction(object): - """Handles the details of organizing and executing transaction - tasks during a UnitOfWork object's flush() operation. - - """ - def __init__(self, session): self.session = session self.mapper_flush_opts = session._mapper_flush_opts diff --git a/lib/sqlalchemy/test/assertsql.py b/lib/sqlalchemy/test/assertsql.py index 1417c2e43..81a6191a1 100644 --- a/lib/sqlalchemy/test/assertsql.py +++ b/lib/sqlalchemy/test/assertsql.py @@ -156,12 +156,15 @@ class CompiledSQL(SQLMatchRule): if not isinstance(params, list): params = [params] - # do a positive compare only - for param, received in zip(params, _received_parameters): - for k, v in param.iteritems(): - if k not in received or received[k] != v: - equivalent = False - break + while params: + param = params.pop(0) + if param not in _received_parameters: + equivalent = False + break + else: + _received_parameters.remove(param) + if _received_parameters: + equivalent = False else: params = {} diff --git a/lib/sqlalchemy/topological.py b/lib/sqlalchemy/topological.py index fbde7c601..a6328a5e4 100644 --- a/lib/sqlalchemy/topological.py +++ b/lib/sqlalchemy/topological.py @@ -9,6 +9,9 @@ from sqlalchemy.exc import CircularDependencyError from sqlalchemy import util +# this enables random orderings for iterated subsets +# of non-dependent items. +#from sqlalchemy.test.util import RandomSet as set __all__ = ['sort', 'sort_as_subsets', 'find_cycles'] |