Beispiel #1
0
 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)
Beispiel #2
0
 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
Beispiel #3
0
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))
Beispiel #4
0
def get_all_block():
    return storage.get_all(Block)
Beispiel #5
0
 def all(kls):
     """get all instances of this class, return a list"""
     return get_all(kls)
Beispiel #6
0
def retrieve_all_events(request):
    events = storage.get_all()
    print events
    return 200, json.dumps(events)
Beispiel #7
0
def get_transactions():
    return storage.get_all(Transaction)
Beispiel #8
0
def get_all():
    return storage.get_all(Node)
Beispiel #9
0
def get_votes():
    return storage.get_all(Vote)