diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-11-23 19:01:40 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-11-23 19:01:40 +0000 |
commit | 238dc916fa9fca6c79046dea004d108df685e29e (patch) | |
tree | 7a35ebdbbd23833834fcab3b3db59e3240d06e43 /lib | |
parent | 41403b79300fb65125ab8bde00efbec9eaa89d43 (diff) | |
download | sqlalchemy-238dc916fa9fca6c79046dea004d108df685e29e.tar.gz |
more changes to merge(dont_load); since we now have a guarantee that
all merged instances aren't dirty, we can copy the attribues without using
any append/replace events, and therefore don't have any concern of lazy loaders
firing off. added tests to ensure that '_is_orphan()' doesn't get screwed up,
and also that the 'dirty' list on the new session stays empty, which is an
extra bonus of this approach.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sqlalchemy/orm/properties.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/properties.py b/lib/sqlalchemy/orm/properties.py index cbc21a2c3..46224aac6 100644 --- a/lib/sqlalchemy/orm/properties.py +++ b/lib/sqlalchemy/orm/properties.py @@ -292,13 +292,19 @@ class PropertyLoader(StrategizedProperty): for current in list(childlist): obj = session.merge(current, entity_name=self.mapper.entity_name, dont_load=dont_load, _recursive=_recursive) if obj is not None: - dest_list.append_with_event(obj) + if dont_load: + dest_list.append_without_event(obj) + else: + dest_list.append_with_event(obj) else: current = list(childlist)[0] if current is not None: obj = session.merge(current, entity_name=self.mapper.entity_name, dont_load=dont_load, _recursive=_recursive) if obj is not None: - setattr(dest, self.key, obj) + if dont_load: + dest.__dict__[self.key] = obj + else: + setattr(dest, self.key, obj) def cascade_iterator(self, type, object, recursive, halt_on=None): if not type in self.cascade: |