Esempio n. 1
0
 def get(self):
     database = self.settings['db']
     query = utils.unpack_params(self)
     docs = database.run_stop.find(query)
     if not docs:
         raise tornado.web.HTTPError(500,
                                     'No results for given query' + str(query))
     else:
         utils.return2client(self, docs)
Esempio n. 2
0
 def get(self):
     database = self.settings['db']
     query = utils.unpack_params(self)
     docs = database.event_descriptor.find(query)
     if not docs:
         raise tornado.web.HTTPError(500,
                                     reason='No results found for query')
     else:
         utils.return2client(self, docs)
Esempio n. 3
0
 def get(self):
     database = self.settings['db']
     query = utils.unpack_params(self)
     _id = query.pop('_id', None)
     num = query.pop('num', None)
     if _id:
         raise tornado.web.HTTPError(500, 'No ObjectId based search supported')
     if num:
         docs = database.run_start.find().sort('time', direction=pymongo.DESCENDING).limit(num)
     else:
         docs = database.run_start.find(query)
     if not docs:
         raise tornado.web.HTTPError(500, reason='No results found for query')
     else:
         utils.return2client(self, docs)
Esempio n. 4
0
 def get(self):
     database = self.settings['db']
     query = utils.unpack_params(self)
     docs = database['event'].find(query)
     if not docs:
         raise tornado.web.HTTPError(500,
                                     status_code='No results for given query' + str(query))
     else:
         self.write('[')
         d = next(docs)
         while True:
             try:
                 del(d['_id'])
                 self.write(ujson.dumps(d))
                 d = next(docs)
                 self.write(',')
             except StopIteration:
                 break
         self.write(']')
     self.finish()