def destroy(self, request, **kwargs): """Performs destroy CRUD action.""" def cb_sendback(result): self.sendback(request, result) UserProfile.destroy(int(kwargs.get('id')[0])).addCallback(cb_sendback) return server.NOT_DONE_YET
def update(self, request, **kwargs): """Performs update CRUD action.""" def cb_sendback(result): self.sendback(request, result) UserProfile.update(kwargs).addCallback(cb_sendback) return server.NOT_DONE_YET
def view(self, request, **kwargs): """Performs read CRUD action.""" def cb_sendback(results): self.sendback(request, {'success' : True, 'data' : results}) UserProfile.get_list().addCallback(cb_sendback) return server.NOT_DONE_YET
def search(self, request, **kwargs): """Performs a search.""" def cb_sendback(result): self.sendback(request, result) UserProfile.search(kwargs.get('object')[0], kwargs.get('condition')[0]).addCallback(cb_sendback) return server.NOT_DONE_YET
def get(self, request, **kwargs): """Performs an extra read CRUD action.""" def cb_sendback(result): self.sendback(request, result) UserProfile.get(int(kwargs.get('id')[0]), kwargs.get('ref', None)).addCallback(cb_sendback) return server.NOT_DONE_YET
def get_schema_model(self, request, **kwargs): """Return the schema model UserProfile architecture.""" model_schema, model_view=UserProfile.get_model_info() if model_schema==None: return json.dumps({ "success" : False, "error" : "Unable to fetch a schema for model user_profile" }) return json.dumps({ "success" : True, "model" : model_schema, "view" : model_view })