예제 #1
0
	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
예제 #2
0
 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
예제 #3
0
파일: coremodel.py 프로젝트: p3pijn/botoweb
    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)
예제 #4
0
파일: coremodel.py 프로젝트: boto/botoweb
	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)
예제 #5
0
	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
예제 #6
0
 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
예제 #7
0
	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)
예제 #8
0
	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)