def test_query_get_all(self): uuids = [] uuids.append(storage.put(Person("mouse1", "minnie1", 23, 22.2)).uuid) uuids.append(storage.put(Person("mouse2", "minnie2", 23, 22.2)).uuid) uuids.append(storage.put(Person("mouse3", "minnie3", 23, 22.2)).uuid) uuids.append(storage.put(Person("mouse4", "minnie4", 23, 22.2)).uuid) persons = storage.get_all(Person, uuids) self.assertEquals(len(persons), 4)
def query(kls, field_name, value): """filter instances by one field value, return a list""" result = [] queryset = get_all(kls) try: result = filter(lambda instance: getattr(instance, field_name) == value, queryset) except AttributeError: print 'No such field' return result
def notify_job(context): links = storage.get_all() for link in links: try: parser.get_latest( context.bot, link['chat_id'], link['link'], link['last_ad_id'], link['name']) except Exception as e: context.bot.send_message(link['chat_id'], text=str(e))
def get_all_block(): return storage.get_all(Block)
def all(kls): """get all instances of this class, return a list""" return get_all(kls)
def retrieve_all_events(request): events = storage.get_all() print events return 200, json.dumps(events)
def get_transactions(): return storage.get_all(Transaction)
def get_all(): return storage.get_all(Node)
def get_votes(): return storage.get_all(Vote)