def __get__(self, model_instance, model_class): """Fetches collection of model instances of this collection property.""" if model_instance is not None: query = Query(self.__model) if type(self.__property) == list: props = [] for prop in self.__property: props.append("%s =" % prop) return query.filter(props, model_instance) else: return query.filter(self.__property + ' =', model_instance) else: return self
def match_reference_property(cls, reference_property, model_instance): ''' :param reference_property: Name (or list of names) of the reference property to match :type reference_property: str or list :param model_instance: Model instance to match to reference property :type model_instance: :class:`~.Model` :return: An iterator with the matched instances of this class :rtype: :class:`~botoweb.db.query.Query` ''' query = Query(cls) if isinstance(reference_property, basestring): return query.filter(reference_property + ' =', model_instance) else: props = ['%s =' % prop for prop in reference_property] return query.filter(props, model_instance)
def find(cls, limit=None, next_token=None, **params): q = Query(cls, limit=limit, next_token=next_token) for key, value in params.items(): q.filter('%s =' % key, value) return q
def __init__(self, *args, **kwargs): if kwargs.has_key('request_limit'): self.request_limit = kwargs['request_limit'] del(kwargs['request_limit']) Query.__init__(self, *args, **kwargs)
def __init__(self, *args, **kwargs): if 'request_limit' in kwargs: self.request_limit = kwargs['request_limit'] del(kwargs['request_limit']) Query.__init__(self, *args, **kwargs)