summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/orm/strategies.py5
-rw-r--r--lib/sqlalchemy/testing/util.py4
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/strategies.py b/lib/sqlalchemy/orm/strategies.py
index c3edbf6e6..2d8a81f0a 100644
--- a/lib/sqlalchemy/orm/strategies.py
+++ b/lib/sqlalchemy/orm/strategies.py
@@ -634,7 +634,7 @@ class LazyLoader(AbstractRelationshipLoader):
LoadLazyAttribute(key), key)
return set_lazy_callable, None, None
- else:
+ elif context.populate_existing or mapper.always_refresh:
def reset_for_lazy_callable(state, dict_, row):
# we are the primary manager for this attribute on
# this class - reset its
@@ -647,6 +647,9 @@ class LazyLoader(AbstractRelationshipLoader):
state._reset(dict_, key)
return reset_for_lazy_callable, None, None
+ else:
+ return None, None, None
+
class LoadLazyAttribute(object):
diff --git a/lib/sqlalchemy/testing/util.py b/lib/sqlalchemy/testing/util.py
index fc8390a79..7b3f721a6 100644
--- a/lib/sqlalchemy/testing/util.py
+++ b/lib/sqlalchemy/testing/util.py
@@ -203,5 +203,7 @@ class adict(dict):
except KeyError:
return dict.__getattribute__(self, key)
- def get_all(self, *keys):
+ def __call__(self, *keys):
return tuple([self[key] for key in keys])
+
+ get_all = __call__