Example #1
0
  def post(self):
    requires_user(self)

    match_id = models.create_new_match(users.get_current_user(), self.request)

    if match_id is None:
      self.redirect('/') # TODO error message
      return

    models.update_scores(match_id)
    
    self.redirect('/')
Example #2
0
  def get(self, matchid):
    if not requires_admin(self):
      return

    match_for_computation = models.delete_match(long(matchid))

    if match_for_computation is None:
      self.redirect('/') # TODO error message
      return

    models.update_scores(match_for_computation)

    self.redirect('/')
Example #3
0
  def post(self):
    if not requires_registered(self):
      return

    match_id = models.create_new_match(users.get_current_user(), self.request)
    memcache.delete_multi([ "ranks", "matches_home_admin", "matches_home" ])

    if match_id is None:
      self.redirect('/') # TODO error message
      return

    models.update_scores(match_id)

    body = "%s %s - %s %s" % (models.get_user_(users.get_current_user()).nickname, self.request.get('score1'),\
                              self.request.get('score2'), models.get_user(long(self.request.get('player2'))).nickname)
    xmpp.send_message(models.get_jids(), body, APP_URL + "@appspot.com", xmpp.MESSAGE_TYPE_CHAT)
    
    self.redirect('/')