Ejemplo n.º 1
0
 def _dumps_default(self, anObject):
     if isinstance(anObject, CQL_QUERY):
         return {'__CQL_QUERY__': cql2string(anObject)}
     for converter in self._converters:
         if isinstance(anObject, converter['type']):
             return {converter['name']: dumps(converter['asDict'](anObject), default=self._dumps_default)}
     raise TypeError(repr(anObject) + 'is not JSON serializable')
Ejemplo n.º 2
0
 def _dumps_default(self, anObject):
     if isinstance(anObject, CQL_QUERY):
         return {'__CQL_QUERY__': cql2string(anObject)}
     for converter in self._converters:
         if isinstance(anObject, converter['type']):
             return {converter['name']: dumps(converter['asDict'](anObject), default=self._dumps_default)}
     raise TypeError(repr(anObject) + 'is not JSON serializable')
Ejemplo n.º 3
0
def _dumps_default(anObject):
    if isinstance(anObject, CQL_QUERY):
        return {'__CQL_QUERY__': cql2string(anObject)}
    elif isinstance(anObject, ComposedQuery):
        return {
            '__COMPOSED_QUERY__': dumps(anObject.asDict(),
                                        default=_dumps_default)
        }
    raise TypeError(repr(anObject) + 'is not JSON serializable')
Ejemplo n.º 4
0
 def assertCql(self, expected, input=None):
     if input == None:
         input = expected
     self.assertEqual(expected, cql2string(parseString(input)))
     self.assertTrue(parseString(expected))
Ejemplo n.º 5
0
 def asString(self):
     return cql2string(self.ast)
Ejemplo n.º 6
0
 def replaceTerm(self, oldTerm, newTerm):
     newAst = CqlReplaceTerm(self.originalAst, oldTerm, newTerm).visit()
     result = WebQuery(cql2string(newAst))
     for f in self._filters:
         result._addFilter(f)
     return result
Ejemplo n.º 7
0
def _dumps_default(anObject):
    if isinstance(anObject, CQL_QUERY):
        return {'__CQL_QUERY__': cql2string(anObject)}
    elif isinstance(anObject, ComposedQuery):
        return {'__COMPOSED_QUERY__': dumps(anObject.asDict(), default=_dumps_default)}
    raise TypeError(repr(anObject) + 'is not JSON serializable')
Ejemplo n.º 8
0
 def assertCql(self, expected, input=None):
     if input == None:
         input = expected
     self.assertEquals(expected, cql2string(parseString(input)))
     self.assertTrue(parseString(expected))
Ejemplo n.º 9
0
 def asString(self):
     return cql2string(self.ast)
Ejemplo n.º 10
0
 def replaceIndex(self, mapping):
     newAst = CqlReplaceIndex(self.originalAst, mapping).visit()
     result = WebQuery(cql2string(newAst))
     for f in self._filters:
         result._addFilter(f)
     return result
Ejemplo n.º 11
0
 def replaceTerm(self, oldTerm, newTerm):
     newAst = CqlReplaceTerm(self.originalAst, oldTerm, newTerm).visit()
     result = WebQuery(cql2string(newAst))
     for f in self._filters:
         result._addFilter(f)
     return result