X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=engine%2Fmanifoldquery.py;h=188a1d4596db44097fa3d1b6aceabf1ff973d1b3;hb=ca4221595008a3344cfa69930e7b8ec8b3660453;hp=b8f594e920d021c915745a4e8a7d58a2bf658bed;hpb=ec878fdba7d729dd64a8c172bc65b539e5e0a158;p=unfold.git diff --git a/engine/manifoldquery.py b/engine/manifoldquery.py index b8f594e9..188a1d45 100644 --- a/engine/manifoldquery.py +++ b/engine/manifoldquery.py @@ -36,10 +36,13 @@ class ManifoldQuery: # xxx unique can be removed, but for now we pad the js structure unique=0 + aq = self.analyzed_query.to_json() if self.analyzed_query else 'null' # subqueries is a dictionary method:query - sq=", ".join ( [ "'%s':%s" % (method, subquery.to_json()) + if not self.subqueries: + sq="{}" + else: + sq=", ".join ( [ "'%s':%s" % (method, subquery.to_json()) for (method, subquery) in self.subqueries.iteritems()]) + sq="{%s}"%sq - aq = self.analyzed_query.to_json() if self.analyzed_query else 'null' - - return "new Query('%(a)s', '%(m)s', '%(t)s', %(f)s, %(p)s, %(c)s, %(unique)s, '%(uuid)s', %(aq)s, {{%(sq)s}})"%locals() + return """ new Query('%(a)s', '%(m)s', '%(t)s', %(f)s, %(p)s, %(c)s, %(unique)s, '%(uuid)s', %(aq)s, %(sq)s)"""%locals()