def get(self): user = users.get_current_user() game_id = cgi.escape(self.request.get('game_id')) if not validate_player(user.nickname(), game_id): #This needs to point to a failure screen self.redirect('/') self.response.out.write( template.render(self.path, {}) )
def post(self): from util import get_world_data user = users.get_current_user() game_id = cgi.escape(self.request.get('game_id')) if not validate_player(user.nickname(), game_id): #This needs to point to a failure screen self.redirect('/') self.response.headers.add_header( 'content-type', 'application/json', charset='utf-8') self.response.out.write( json.dumps(get_world_data(user.nickname(), game_id)) )
def post(self): from ambi import move_character user = users.get_current_user() game_id = cgi.escape(self.request.get('game_id')) if not validate_player(user.nickname(), game_id): #This needs to point to a failure screen return self.redirect('/') x = cgi.escape(self.request.get('x')) y = cgi.escape(self.request.get('y')) self.response.headers.add_header( 'content-type', 'application/json', charset='utf-8') self.response.out.write( json.dumps(move_character(game_id, x, y)) )