def post(self): global response_time global current_focus t = time.time() title = self.request.get('title') question = create_test_question(title) locql.create_question(question) response_time = (time.time()-t)*1000 current_focus = annotate_places(title) self.redirect('/')
def post(self): if not self.auth(): return jsonobj = json.loads(self.request.get('question', default_value='[]')) question = jsonobj2question(jsonobj) if not question: self.error(400) # bad request operation = self.request.get('operation', default_value='create') if operation == 'create': if locql.create_question(question): self.response.set_status(200) # success else: self.error(400) # failure elif operation == 'delete': if locql.delete_question(question): self.response.set_status(201) # success else: self.error(400) # failure else: self.error(400) # bad request