--- a/server/querier.py Sat Oct 09 00:05:50 2010 +0200
+++ b/server/querier.py Sat Oct 09 00:05:52 2010 +0200
@@ -602,9 +602,7 @@
self._parse = rqlhelper.parse
self._annotate = rqlhelper.annotate
# rql planner
- # note: don't use repo.sources, may not be built yet, and also "admin"
- # isn't an actual source
- if len([uri for uri in repo.config.sources() if uri != 'admin']) < 2:
+ if len(repo.sources) < 2:
from cubicweb.server.ssplanner import SSPlanner
self._planner = SSPlanner(schema, rqlhelper)
else:
@@ -613,6 +611,14 @@
# sql generation annotator
self.sqlgen_annotate = SQLGenAnnotator(schema).annotate
+ def set_planner(self):
+ if len(self._repo.sources) < 2:
+ from cubicweb.server.ssplanner import SSPlanner
+ self._planner = SSPlanner(self.schema, self._repo.vreg.rqlhelper)
+ else:
+ from cubicweb.server.msplanner import MSPlanner
+ self._planner = MSPlanner(self.schema, self._repo.vreg.rqlhelper)
+
def parse(self, rql, annotate=False):
"""return a rql syntax tree for the given rql"""
try: