示例#1
0
  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))
示例#2
0
  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))