예제 #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))
예제 #3
0
  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)
예제 #4
0
 def get(self, team, clue):
   self.writeJsonp(json.dumps(clues.get(self.cursor, team, clue).get("photos", [])))
예제 #5
0
 def get(self, team, clue):
   self.writeJsonp(json.dumps(clues.get(self.db, team, clue)["photos"]))
   self.db.close()