Commit 12795e97 authored by Jogi Hofmüller's avatar Jogi Hofmüller

Add basic function to add new Gerücht

parent 7425ba57
......@@ -127,22 +127,24 @@ class GeruechtHandler(RestHandler):
self.finish(data)
class AddHandler(RestHandler):
'''
Handler to let users add new Gerüchte
'''
def set_default_headers(self):
# while testing leave this open to anyone
self.set_header('Access-Control-Allow-Origin', frontendurl)
self.set_header('Access-Control-Allow-Credentials', 'true')
self.set_header('Access-Control-Allow-Methods', 'POST, GET, OPTIONS, DELETE, PUT')
self.set_header('Access-Control-Allow-Methods', 'OPTIONS, PUT')
self.set_header("Access-Control-Allow-Headers", 'Content-Type')
@tornado.web.asynchronous
def post(self):
logmsg('AddHandler')
data = tornado.escape.json_decode(self.request.body)
logmsg(data['type'])
self.finish(json.dumps({'status': 'success', 'message': 'not implemented yet'}))
def put(self):
sentence = tornado.escape.json_decode(self.request.body)
gdb.addNewGeruecht(sentence)
self.finish(json.dumps({'status': 'success', 'message': sentence}))
class LoginHandler(RestHandler):
def set_default_headers(self):
# while testing leave this open to anyone
self.set_header('Access-Control-Allow-Origin', frontendurl)
self.set_header('Access-Control-Allow-Credentials', 'true')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment