diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-12-20 19:00:36 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-12-20 19:00:36 -0500 |
commit | fafec792aa44be293cd7044f1f12c29e16a4ef8b (patch) | |
tree | 193ff00290fe358d01a845f1eb36978d657d15ff /lib/sqlalchemy/orm | |
parent | 4ace012030c30e4665fe396f2622fbf09f73ea05 (diff) | |
download | sqlalchemy-fafec792aa44be293cd7044f1f12c29e16a4ef8b.tar.gz |
callcount reduction
Diffstat (limited to 'lib/sqlalchemy/orm')
-rw-r--r-- | lib/sqlalchemy/orm/interfaces.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/sqlalchemy/orm/interfaces.py b/lib/sqlalchemy/orm/interfaces.py index 28ab383c3..d50aea83a 100644 --- a/lib/sqlalchemy/orm/interfaces.py +++ b/lib/sqlalchemy/orm/interfaces.py @@ -296,9 +296,9 @@ class StrategizedProperty(MapperProperty): """ def _get_context_strategy(self, context, path): - cls = context.attributes.get(('loaderstrategy', - _reduce_path(path)), None) - if cls: + key = ('loaderstrategy', _reduce_path(path)) + if key in context.attributes: + cls = context.attributes[key] try: return self._strategies[cls] except KeyError: @@ -546,9 +546,9 @@ def _reduce_path(path): """ return tuple([i % 2 != 0 and - path[i] or - getattr(path[i], 'base_mapper', path[i]) - for i in xrange(len(path))]) + element or + getattr(element, 'base_mapper', element) + for i, element in enumerate(path)]) class LoaderStrategy(object): """Describe the loading behavior of a StrategizedProperty object. |