Esempio n. 1
0
 def index(self, offset, limit, location=None, radius=None):
     if location is not None:
         coordinates = [float(s) for s in location.split(',')]
         radius = radius if radius else Collection.default_radius
         cursor = model.Report.get_by_location(self.db, offset, limit,
                                               coordinates, radius)
         query = dict(offset=offset, limit=limit, location=location,
                      radius=radius)
     else:
         cursor = model.Report.get_newests(self.db, offset, limit)
         query = dict(offset=offset, limit=limit)
     return royal.PaginatedResult(self, cursor, Resource, query,
                                  cursor.count())
Esempio n. 2
0
File: user.py Progetto: hadrien/velo
 def index(self, offset, limit):
     cursor = User.get_newests(self.db, offset, limit)
     query = dict(offset=offset, limit=limit)
     return royal.PaginatedResult(self, cursor, Resource, query,
                                  cursor.count())
Esempio n. 3
0
 def index(self, offset, limit):
     cursor = model.Photo.get_by_report(self.db, self.report.model._id)
     query = dict(offset=offset, limit=limit)
     return royal.PaginatedResult(self, cursor, photo.Resource, query,
                                  cursor.count())
Esempio n. 4
0
 def index(self, params):
     offset = params['offset']
     limit = params['limit']
     cursor = Photo.get_newests(self.root.db, offset, limit)
     query = dict(offset=offset, limit=limit)
     return royal.PaginatedResult(self, cursor, Item, query, cursor.count())
Esempio n. 5
0
 def index(self, offset, limit):
     query = dict(offset=offset, limit=limit)
     cursor = model.Report.get_by_author(self.db, self.user.model.username,
                                         offset, limit)
     return royal.PaginatedResult(self.root['reports'], cursor,
                                  report.Resource, query, cursor.count())