def put(self, team, clue_number): clue = clues.decode(self.request.body) print clue with commit(self.connection): if clues.get(self.cursor, team, clue_number) is None: clues.create(self.cursor, team, clue_number, clue) else: clue = clues.update(self.cursor, team, clue_number, clue) self.writeJsonp(json.dumps(clue))
def put(self, team, clue_number): if self.request.headers.get("Expect", "") == "100-continue": self.set_header("Accept", "text/plain, application/json") self.set_status(100) return clue = clues.decode(self.request.body) if clues.get(self.db, team, clue_number) is None: clues.create(self.db, team, clue_number, clue) else: clue = clues.update(self.db, team, clue_number, clue) self.db.close() self.writeJsonp(json.dumps(clue))
def wrapped(self, team, clue, *args, **kwargs): if clues.get(self.cursor, team, clue) is None: raise tornado.web.HTTPError(404) fun(self, team, clue, *args, **kwargs)
def get(self, team, clue): self.writeJsonp(json.dumps(clues.get(self.cursor, team, clue).get("photos", [])))
def get(self, team, clue): self.writeJsonp(json.dumps(clues.get(self.db, team, clue)["photos"])) self.db.close()