refactor
This commit is contained in:
22
tableapi.py
22
tableapi.py
@ -21,22 +21,26 @@ class TableAPI:
|
||||
def data(self, df):
|
||||
self.dfh.df = df
|
||||
|
||||
@cp.tools.json_in()
|
||||
def PATCH(self, **kwargs):
|
||||
kwargs = kwargs or cp.request.json
|
||||
self.dfh.append(kwargs)
|
||||
self.changed = True
|
||||
rerun(self.sid)
|
||||
return str(self.dfh.df)
|
||||
|
||||
def GET(self):
|
||||
return str(self.dfh.df)
|
||||
|
||||
@cp.tools.json_in()
|
||||
def PATCH(self, **kwargs):
|
||||
kwargs = kwargs or cp.request.json
|
||||
self.dfh.append(kwargs)
|
||||
self._trigger_changed()
|
||||
return str(self.dfh.df)
|
||||
|
||||
def DELETE(self):
|
||||
self.dfh.clear()
|
||||
self.changed = True
|
||||
rerun(self.sid)
|
||||
self._trigger_changed()
|
||||
return "cleared"
|
||||
|
||||
|
||||
def _trigger_changed(self):
|
||||
self.changed = True
|
||||
rerun(self.sid)
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user