current_page = request.params.get('page', 1)
- mmap = DBSession.query(Map).filter_by(map_id=map_id).one()
-
- mct_q = DBSession.query(PlayerCaptime.fastest_cap, PlayerCaptime.create_dt,
- PlayerCaptime.player_id, PlayerCaptime.game_id,
- Game.server_id, Server.name.label('server_name'),
- PlayerGameStat.nick.label('player_nick')).\
- filter(PlayerCaptime.map_id==map_id).\
- filter(PlayerCaptime.game_id==Game.game_id).\
- filter(PlayerCaptime.map_id==Map.map_id).\
- filter(Game.server_id==Server.server_id).\
- filter(PlayerCaptime.player_id==PlayerGameStat.player_id).\
- filter(PlayerCaptime.game_id==PlayerGameStat.game_id).\
- order_by(expr.asc(PlayerCaptime.fastest_cap))
+ try:
+ mmap = DBSession.query(Map).filter_by(map_id=map_id).one()
+
+ mct_q = DBSession.query(PlayerCaptime.fastest_cap, PlayerCaptime.create_dt,
+ PlayerCaptime.player_id, PlayerCaptime.game_id,
+ Game.server_id, Server.name.label('server_name'),
+ PlayerGameStat.nick.label('player_nick')).\
+ filter(PlayerCaptime.map_id==map_id).\
+ filter(PlayerCaptime.game_id==Game.game_id).\
+ filter(PlayerCaptime.map_id==Map.map_id).\
+ filter(Game.server_id==Server.server_id).\
+ filter(PlayerCaptime.player_id==PlayerGameStat.player_id).\
+ filter(PlayerCaptime.game_id==PlayerGameStat.game_id).\
+ order_by(expr.asc(PlayerCaptime.fastest_cap))
+
+ except Exception as e:
+ raise pyramid.httpexceptions.HTTPNotFound
map_captimes = Page(mct_q, current_page, items_per_page=20, url=page_url)
current_page = request.params.get("page", 1)
- player = DBSession.query(Player).filter_by(player_id=player_id).one()
-
- pct_q = DBSession.query(PlayerCaptime.fastest_cap, PlayerCaptime.create_dt,
- PlayerCaptime.player_id, PlayerCaptime.game_id, PlayerCaptime.map_id,
- Map.name.label('map_name'), Game.server_id, Server.name.label('server_name')).\
- filter(PlayerCaptime.player_id==player_id).\
- filter(PlayerCaptime.game_id==Game.game_id).\
- filter(PlayerCaptime.map_id==Map.map_id).\
- filter(Game.server_id==Server.server_id).\
- order_by(expr.desc(PlayerCaptime.create_dt))
+ try:
+ player = DBSession.query(Player).filter_by(player_id=player_id).one()
+
+ pct_q = DBSession.query(PlayerCaptime.fastest_cap, PlayerCaptime.create_dt,
+ PlayerCaptime.player_id, PlayerCaptime.game_id, PlayerCaptime.map_id,
+ Map.name.label('map_name'), Game.server_id, Server.name.label('server_name')).\
+ filter(PlayerCaptime.player_id==player_id).\
+ filter(PlayerCaptime.game_id==Game.game_id).\
+ filter(PlayerCaptime.map_id==Map.map_id).\
+ filter(Game.server_id==Server.server_id).\
+ order_by(expr.desc(PlayerCaptime.create_dt))
+
+ except Exception as e:
+ raise pyramid.httpexceptions.HTTPNotFound
captimes = Page(pct_q, current_page, items_per_page=20, url=page_url)