示例#1
0
 def get_books(self):
     '''
     Ajax backend for fetching books
     '''
     req = cherrypy.request.json
     page = req.get('page')
     query = req.get('query')
     return libraries.get_books(DB, page, query)
示例#2
0
 def get_books(self):
     '''
     Ajax backend for fetching books
     '''
     req = cherrypy.request.json
     page = req.get('page')
     query = req.get('query')
     return libraries.get_books(DB, page, query)
示例#3
0
 def get_books(self):
     '''
     Ajax backend for fetching books
     '''
     # this could easily be handled by using json_in decorator. however,
     # cherrypy testing is hard using the same decorator. hence...
     cl = cherrypy.request.headers['Content-Length']
     rawbody = cherrypy.request.body.read(int(cl))
     # parse json from request body
     params = simplejson.loads(rawbody)
     page = params.get('page')
     query = params.get('query')
     books = libraries.get_books(cherrypy.thread_data.db, page, query)
     return books
示例#4
0
 def get_books(self):
     '''
     Ajax backend for fetching books
     '''
     # this could easily be handled by using json_in decorator. however,
     # cherrypy testing is hard using the same decorator. hence...
     cl = cherrypy.request.headers['Content-Length']
     rawbody = cherrypy.request.body.read(int(cl))
     # parse json from request body
     params = simplejson.loads(rawbody)
     page = params.get('page')
     query = params.get('query')
     books = libraries.get_books(cherrypy.thread_data.db, page, query)
     return books