config.add_route("server_index_json", "/servers.json")
config.add_view(server_index_json, route_name="server_index_json", renderer="jsonp")
- config.add_route("server_game_index", "/server/{server_id:\d+}/games/page/{page:\d+}")
- config.add_view(server_game_index, route_name="server_game_index", renderer="server_game_index.mako")
-
- config.add_route("server_game_index_json", "/server/{server_id:\d+}/games.json")
- config.add_view(server_game_index_json, route_name="server_game_index_json", renderer="jsonp")
-
config.add_route("server_info", "/server/{id:\d+}")
config.add_view(server_info, route_name="server_info", renderer="server_info.mako")
List the stored information about a given server. JSON.
"""
return [{'status':'not implemented'}]
-
-
-def _server_game_index_data(request):
- server_id = request.matchdict['server_id']
- current_page = request.matchdict['page']
-
- try:
- server = DBSession.query(Server).filter_by(server_id=server_id).one()
-
- games_q = DBSession.query(Game, Server, Map).\
- filter(Game.server_id == server_id).\
- filter(Game.server_id == Server.server_id).\
- filter(Game.map_id == Map.map_id).\
- order_by(Game.game_id.desc())
-
- games = Page(games_q, current_page, url=page_url)
- except Exception as e:
- server = None
- games = None
- raise e
-
- return {'games':games,
- 'server':server}
-
-
-def server_game_index(request):
- """
- List the games played on a given server. Paginated.
- """
- return _server_game_index_data(request)
-
-
-def server_game_index_json(request):
- """
- List the games played on a given server. Paginated. JSON.
- """
- return [{'status':'not implemented'}]