Example #1
0
    def set_url_params(self, name, value):

        if isinstance(value, dict):
            criteria = Criteria.List(
                *
                [Criteria.Field(key, value)
                 for (key, value) in value.items()]).toURLParams()

        elif isinstance(value, list) or \
             isinstance(value, tuple):
            criteria = Criteria.List(*value).toURLParams()

        elif isinstance(value, str) or \
             isinstance(value, int) or \
             isinstance(value, float):
            criteria = Criteria.Raw(str(value)).toURLParams()

        elif isinstance(value, Criteria.Base):
            criteria = value.toURLParams()

        else:
            raise Exception

        self._url_params[name] = criteria
Example #2
0
 def init_criteria_from_criteria(self, *args):
     self.criteria = Criteria.List(*args)
Example #3
0
 def init_criteria_from_dictionnary(self, dictionnary):
     self.criteria = Criteria.List(*[
         Criteria.Field(key, value) for (key, value) in dictionnary.items()
     ])