Beispiel #1
0
 def edit(self, id=None):
     m=Model()
     try:
         print("  .. GET Edit Data (ID): " + id)
         res = m.find_by_id(id)
         self.success(message="connections, edit id: " + str(id), data=res)
     except Exception as e:
         self.error(message="connections, edit id: " + str(id) + "msg: " + str(e) , data=None)
Beispiel #2
0
 def destroy(self, id=None):
     try:
         data_json = self.request.body
         print("  .. DELETE Data: ID:" + str(data_json))
         m=Model()
         m.init_from_json(data_json)
         res = m.find_by_id(m.id)
         res.delete()
         self.success(message="connections, successfully deletd id: " + str(m.id), data=str(m.id), format="json")
     except Exception as e:
         self.error(message="connections, destroy id: " + str(e))
Beispiel #3
0
 def update(self, id=None):
     data_json = self.request.body
     m=Model()
     res = m.find_by_id(id)
     res.init_from_json(data_json, simple_conversion=True)
     try:
         #res.tags= res.tags.split(",")
         res.upsert()
         self.success(message="connections, successfully updated " + str(res.id), 
             data=res, format="json")
     except Exception as e:
         self.error(message="connections, error updating: " + str(m.id) + "msg: " + str(e), data=data_json, format="json")
Beispiel #4
0
 def show(self, id=None):
     m=Model()
     res=m.find_by_id(id)
     self.success(message="connections show", data=res)