Beispiel #1
0
 def add_or(self, condition):
     '''
     Añade una pareja al árbol
     '''
     # Comprobamos la condición
     if not isinstance(condition, dict):
         raise Exception('Query.add_or()','Condition must be a dictionary')
     if len(self.expression) == 0:
         self.expression = dstools.normalizar(condition)
     else:
         self.expression = dict({'$or' :[self.expression, dstools.normalizar(condition)]})
     return self.expression
Beispiel #2
0
 def __init__(self, condition = None):
     '''
     Constructor
     '''
     if condition != None:
         if not isinstance(condition, dict):
             raise Exception('Query.__init__()','Condition must be a dictionary')
         self.expression = dstools.normalizar(condition)
     else:
         self.expression = dict()