Exemplo n.º 1
0
 def destroy(self, request, **kwargs):
     """Performs destroy CRUD action."""
     
     def cb_sendback(result):
         self.sendback(request, result)
     
     Cargo.destroy(kwargs.get('data')).addCallback(cb_sendback)
     
     return server.NOT_DONE_YET
Exemplo n.º 2
0
 def update(self, request, **kwargs):
     """Performs update CRUD action."""
     
     def cb_sendback(result):
         self.sendback(request, result)
     
     Cargo.update(eval(kwargs.get('data')[0])).addCallback(cb_sendback)
     
     return server.NOT_DONE_YET
Exemplo n.º 3
0
    def view(self, request, **kwargs):
        """Performs read CRUD action."""
        
        def cb_sendback(result):
            self.sendback(request, result)

        Cargo.view().addCallback(cb_sendback)

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