diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-11-01 20:12:36 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-11-01 20:12:36 +0000 |
| commit | 2e9501683d42855105f80445a5e2e812d9390506 (patch) | |
| tree | 3729c0a335033763ba598268d71bac764c79549f /lib/sqlalchemy/orm/unitofwork.py | |
| parent | 1bf0aee385e3164254bed0dcc6e005613806a665 (diff) | |
| download | sqlalchemy-2e9501683d42855105f80445a5e2e812d9390506.tar.gz | |
- session checks more carefully when determining "object X already in another session";
e.g. if you pickle a series of objects and unpickle (i.e. as in a Pylons HTTP session
or similar), they can go into a new session without any conflict
- added stricter checks around session.delete() similar to update()
- shored up some old "validate" stuff in session/uow
Diffstat (limited to 'lib/sqlalchemy/orm/unitofwork.py')
| -rw-r--r-- | lib/sqlalchemy/orm/unitofwork.py | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/lib/sqlalchemy/orm/unitofwork.py b/lib/sqlalchemy/orm/unitofwork.py index 43f0d46d9..0ce354d6f 100644 --- a/lib/sqlalchemy/orm/unitofwork.py +++ b/lib/sqlalchemy/orm/unitofwork.py @@ -109,11 +109,6 @@ class UnitOfWork(object): except KeyError: pass - def _validate_obj(self, obj): - if (hasattr(obj, '_instance_key') and obj._instance_key not in self.identity_map) or \ - (not hasattr(obj, '_instance_key') and obj not in self.new): - raise exceptions.InvalidRequestError("Instance '%s' is not attached or pending within this session" % repr(obj)) - def _is_valid(self, obj): if (hasattr(obj, '_instance_key') and obj._instance_key not in self.identity_map) or \ (not hasattr(obj, '_instance_key') and obj not in self.new): @@ -147,9 +142,7 @@ class UnitOfWork(object): def register_deleted(self, obj): """register the given persistent object as 'to be deleted' within this unit of work.""" - if obj not in self.deleted: - self._validate_obj(obj) - self.deleted.add(obj) + self.deleted.add(obj) def locate_dirty(self): """return a set of all persistent instances within this unit of work which |
