예제 #1
0
    def find_by_id(self, item_id):
        result = store.find(self.__storage_name, key="id", value=item_id)

        if not result:
            return []

        self.set_attributes(result[0])
        return self
예제 #2
0
	def search_items(cls, query):
		items=[]
		direction=None
		if 'lowtohigh' in query and query['lowtohigh']=="1":
			direction=ASCENDING
		if 'hightolow' in query and query['hightolow']=="1":
			print "YES"
			direction=DESCENDING
		query=cls.gen_query(query)
		for item in store.find(query).sort("price", direction):
			items.append(cls.modify(item))
		return items
예제 #3
0
	def get_all(cls):
		items=[]
		for item in store.find().sort("price"):
			items.append(cls.modify(item))
		return items
예제 #4
0
 def find_where(self, key, value):
     return store.find(self.__storage_name, key, value)