From: Mike Bayer Date: Tue, 23 Mar 2010 15:14:02 +0000 (-0400) Subject: that was easy X-Git-Tag: rel_0_6beta3~12^2~32 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f130b2f04dd2bc94e086d48e9eaa41644ad8850f;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git that was easy --- diff --git a/lib/sqlalchemy/orm/strategies.py b/lib/sqlalchemy/orm/strategies.py index db3d565c46..46cfdbe61c 100644 --- a/lib/sqlalchemy/orm/strategies.py +++ b/lib/sqlalchemy/orm/strategies.py @@ -704,24 +704,9 @@ class SubqueryLoader(AbstractRelationshipLoader): q = q.order_by(*local_attr) - # place loaderstrategy tokens in the new query - # so that further loader strategy options take effect. - # TODO: use the actual options in the parent query, - # figure out how to achieve the path-manipulation - # (should probably use _current_path). - # some of these options may be user-defined so they - # must propagate. - # consider adding a new call to MapperOption that is - # specific to subquery loads. - for attr in context.attributes: - strat, opt_path = attr - if strat == "loaderstrategy": - # TODO: make sure we understand this part - #opt_path = opt_path[len(path):] # works, i think this - # leaves excess tho - opt_path = opt_path[2:] # also works - q._attributes[("loaderstrategy", opt_path)] =\ - context.query._attributes[attr] + # propagate loader options etc. to the new query + q = q._with_current_path(subq_path) + q = q._conditional_options(*orig_query._with_options) if self.parent_property.order_by: q = q.order_by(*self.parent_property.order_by) diff --git a/test/orm/test_subquery_relations.py b/test/orm/test_subquery_relations.py index c379e74891..efa589f3c6 100644 --- a/test/orm/test_subquery_relations.py +++ b/test/orm/test_subquery_relations.py @@ -174,6 +174,7 @@ class EagerTest(_fixtures.FixtureTest, testing.AssertsCompiledSQL): ("subqueryload", "subqueryload", "eagerload", 3), ] # _pathing_runs = [("subqueryload", "subqueryload", "eagerload", 3)] +# _pathing_runs = [("subqueryload", "subqueryload", "subqueryload", 4)] def test_options_pathing(self): self._do_options_test(self._pathing_runs)