From c768f7303822f622806bceef64339aacf66fb432 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 31 May 2011 17:38:34 -0400 Subject: [PATCH] - remove the old term 'selectcontext' - don't swing the GOF hammer so hard --- lib/sqlalchemy/orm/interfaces.py | 4 ++-- lib/sqlalchemy/orm/strategies.py | 37 ++++++++++++++++++++------------ 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/lib/sqlalchemy/orm/interfaces.py b/lib/sqlalchemy/orm/interfaces.py index 1c4b59ca39..07a6a782c2 100644 --- a/lib/sqlalchemy/orm/interfaces.py +++ b/lib/sqlalchemy/orm/interfaces.py @@ -80,7 +80,7 @@ class MapperProperty(object): pass - def create_row_processor(self, selectcontext, path, reduced_path, + def create_row_processor(self, context, path, reduced_path, mapper, row, adapter): """Return a 3-tuple consisting of three row processing functions. @@ -648,7 +648,7 @@ class LoaderStrategy(object): def setup_query(self, context, entity, path, reduced_path, adapter, **kwargs): pass - def create_row_processor(self, selectcontext, path, reduced_path, mapper, + def create_row_processor(self, context, path, reduced_path, mapper, row, adapter): """Return row processing functions which fulfill the contract specified by MapperProperty.create_row_processor. diff --git a/lib/sqlalchemy/orm/strategies.py b/lib/sqlalchemy/orm/strategies.py index acdac9984d..c91bdd03aa 100644 --- a/lib/sqlalchemy/orm/strategies.py +++ b/lib/sqlalchemy/orm/strategies.py @@ -106,18 +106,18 @@ class UninstrumentedColumnLoader(LoaderStrategy): c = adapter.columns[c] column_collection.append(c) - def create_row_processor(self, selectcontext, path, reduced_path, mapper, row, adapter): + def create_row_processor(self, context, path, reduced_path, mapper, row, adapter): return None, None, None class ColumnLoader(LoaderStrategy): - """Strategize the loading of a plain column-based MapperProperty.""" + """Provide loading behavior for a :class:`.ColumnProperty`.""" def init(self): self.columns = self.parent_property.columns self.is_composite = hasattr(self.parent_property, 'composite_class') - def setup_query(self, context, entity, path, reduced_path, adapter, - column_collection=None, **kwargs): + def setup_query(self, context, entity, path, reduced_path, + adapter, column_collection, **kwargs): for c in self.columns: if adapter: c = adapter.columns[c] @@ -137,7 +137,8 @@ class ColumnLoader(LoaderStrategy): active_history = active_history ) - def create_row_processor(self, selectcontext, path, reduced_path, mapper, row, adapter): + def create_row_processor(self, context, path, reduced_path, + mapper, row, adapter): key = self.key # look through list of columns represented here # to see which, if any, is present in the row. @@ -156,9 +157,9 @@ class ColumnLoader(LoaderStrategy): log.class_logger(ColumnLoader) class DeferredColumnLoader(LoaderStrategy): - """Strategize the loading of a deferred column-based MapperProperty.""" + """Provide loading behavior for a deferred :class:`.ColumnProperty`.""" - def create_row_processor(self, selectcontext, path, reduced_path, mapper, row, adapter): + def create_row_processor(self, context, path, reduced_path, mapper, row, adapter): col = self.columns[0] if adapter: col = adapter.columns[col] @@ -167,7 +168,7 @@ class DeferredColumnLoader(LoaderStrategy): if col in row: return self.parent_property._get_strategy(ColumnLoader).\ create_row_processor( - selectcontext, path, reduced_path, mapper, row, adapter) + context, path, reduced_path, mapper, row, adapter) elif not self.is_class_level: def new_execute(state, dict_, row): @@ -294,7 +295,10 @@ class AbstractRelationshipLoader(LoaderStrategy): self.uselist = self.parent_property.uselist class NoLoader(AbstractRelationshipLoader): - """Strategize a relationship() that doesn't load data automatically.""" + """Provide loading behavior for a :class:`.RelationshipProperty` + with "lazy=None". + + """ def init_class_attribute(self, mapper): self.is_class_level = True @@ -305,7 +309,7 @@ class NoLoader(AbstractRelationshipLoader): typecallable = self.parent_property.collection_class, ) - def create_row_processor(self, selectcontext, path, reduced_path, mapper, row, adapter): + def create_row_processor(self, context, path, reduced_path, mapper, row, adapter): def new_execute(state, dict_, row): state.initialize(self.key) return new_execute, None, None @@ -313,7 +317,10 @@ class NoLoader(AbstractRelationshipLoader): log.class_logger(NoLoader) class LazyLoader(AbstractRelationshipLoader): - """Strategize a relationship() that loads when first accessed.""" + """Provide loading behavior for a :class:`.RelationshipProperty` + with "lazy=True", that is loads when first accessed. + + """ def init(self): super(LazyLoader, self).init() @@ -555,7 +562,7 @@ class LazyLoader(AbstractRelationshipLoader): else: return None - def create_row_processor(self, selectcontext, path, reduced_path, + def create_row_processor(self, context, path, reduced_path, mapper, row, adapter): key = self.key if not self.is_class_level: @@ -901,8 +908,10 @@ class SubqueryLoader(AbstractRelationshipLoader): log.class_logger(SubqueryLoader) class EagerLoader(AbstractRelationshipLoader): - """Strategize a relationship() that loads within the process - of the parent object being selected.""" + """Provide loading behavior for a :class:`.RelationshipProperty` + using joined eager loading. + + """ def init(self): super(EagerLoader, self).init() -- 2.39.5