diff options
Diffstat (limited to 'server/buttonDispatcher.py')
-rw-r--r-- | server/buttonDispatcher.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/server/buttonDispatcher.py b/server/buttonDispatcher.py index 8938288..d3331bd 100644 --- a/server/buttonDispatcher.py +++ b/server/buttonDispatcher.py @@ -1,12 +1,12 @@ import json -import cherrypy +from bottle import Bottle, route from button import loadAll, Button from dispatcher import Dispatcher from lib import uuid # Tweak: consider using serpy for serializing objects for JSON. -@cherrypy.expose +@app.route('/') class ButtonDispatcher(Dispatcher): @cherrypy.tools.json_out() def GET(self, id=None): @@ -39,7 +39,7 @@ class ButtonDispatcher(Dispatcher): return button.toDict() @cherrypy.tools.json_out() - def PUT(self, id, status): + def PUT(self, id): # POST /button/{id}?status={} - updates button status self.validate_uuid(id) @@ -54,8 +54,10 @@ class ButtonDispatcher(Dispatcher): return button.toDict() @cherrypy.tools.json_out() - def DELETE(self, id): + def DELETE(self, id, status, *path, **args): # DELETE /button/{id} - deletes button + self.validate_uuid(id) + button = Button() button.loadById(id) button.delete() |