3 # xxx php has uniqid, need to find a module for that
5 def uniqid (): global counter; counter += 1; return counter
9 def __init__ (self, action=None, method=None, timestamp='now',
10 filters=[], params=[], fields=[],
11 sort=None, limit=None, offset=None,
17 self.timestamp=timestamp
25 self.analyzed_query=None
33 f=json.dumps (self.filters)
34 p=json.dumps (self.params)
35 c=json.dumps (self.fields)
36 # xxx unique can be removed, but for now we pad the js structure
39 # subqueries is a dictionary method:query
40 sq=", ".join ( [ "'%s':%s" % (method, subquery.to_json())
41 for (method, subquery) in self.subqueries.iteritems()])
43 aq = self.analyzed_query.to_json() if self.analyzed_query else 'null'
45 return "new Query('%(a)s', '%(m)s', '%(t)s', %(f)s, %(p)s, %(c)s, %(unique)s, '%(uuid)s', %(aq)s, {{%(sq)s}})"%locals()