def game(): device_id = request.cookies.get('device_id') device = Device.query.get(device_id) if not device: abort(404, 'Device not found') game = Game.current() player = Player.current(device_id) response = make_response(render_template('scoring.html')) return response
def game_info(): if not request.cookies.get('device_id'): abort(404, 'Device not found') device_id = request.cookies.get('device_id') device = Device.query.get(device_id) if not device: abort(404, 'Device not found') game = Game.current() player = Player.current(device_id) ret = dict(game=game.to_dict(), player=player.to_dict(), device=device.to_dict()) response = jsonate(ret) return response
def game_join(): device_id = request.cookies.get('device_id') device = Device.query.get(device_id) if not device: abort(403, 'No device found') player = Player.current(device.id) if player: return redirect('/game', code=302) current_game = Game.current() if not current_game: abort(404, 'No current game') game = get_game_manager() game.create_player(device) return redirect('/game', code=302)