def put(self, *args): path_elements = [x for x in self.request.path.split("/") if x] game = Game(self.request.body) game.id = path_elements[0] game.save() self.set_header('Content-Type', 'application/json') self.finish(game.toJSON())
def post(self): g = Game(self.request.body) g.id = id_generator() g.save() self.set_header('Content-Type', 'application/json') self.finish(g.toJSON())