]> de.git.xonotic.org Git - xonotic/xonstat.git/blobdiff - xonstat/__init__.py
Refactor the map_index views.
[xonotic/xonstat.git] / xonstat / __init__.py
index b925989c2be691d0e948cebcf16d769f5b978ae4..1d2e0750b5001e955e3351857af2ba198a52e93d 100644 (file)
@@ -135,43 +135,41 @@ def main(global_config, **settings):
 
     # SERVER ROUTES
     config.add_route("server_index", "/servers")
-    config.add_view(
-        view=ServerIndex,
-        route_name="server_index",
-        attr="html",
-        renderer="server_index.mako",
-        accept="text/html"
-    )
-    config.add_view(
-        view=ServerIndex,
-        route_name="server_index",
-        attr="json",
-        renderer="json",
-        accept="text/json"
-    )
+    config.add_view(view=ServerIndex, route_name="server_index", attr="html",
+                    renderer="server_index.mako", accept="text/html")
+    config.add_view(view=ServerIndex, route_name="server_index", attr="json", renderer="json",
+                    accept="application/json")
+
+    config.add_route("server_top_maps", "/server/{id:\d+}/topmaps")
+    config.add_view(view=ServerTopMaps, route_name="server_top_maps", attr="html",
+                    renderer="server_top_maps.mako", accept="text/html")
+    config.add_view(view=ServerTopMaps, route_name="server_top_maps", attr="json", renderer="json",
+                    accept="application/json")
+
+    config.add_route("server_top_active", "/server/{id:\d+}/topactive")
+    config.add_view(view=ServerTopPlayers, route_name="server_top_active", attr="html",
+                    renderer="server_top_active.mako", accept="text/html")
+    config.add_view(view=ServerTopPlayers, route_name="server_top_active", attr="json",
+                    renderer="json", accept="application/json")
+
+    config.add_route("server_top_scorers", "/server/{id:\d+}/topscorers")
+    config.add_view(view=ServerTopScorers, route_name="server_top_scorers", attr="html",
+                    renderer="server_top_scorers.mako", accept="text/html")
+    config.add_view(view=ServerTopScorers, route_name="server_top_scorers", attr="json",
+                    renderer="json", accept="application/json")
 
     config.add_route("server_info", "/server/{id:\d+}")
-    config.add_view(
-        view=ServerInfo,
-        route_name="server_info",
-        attr="html",
-        renderer="server_info.mako",
-        accept="text/html"
-    )
-    config.add_view(
-        view=ServerInfo,
-        route_name="server_info",
-        attr="json",
-        renderer="server_info.mako",
-        accept="text/json"
-    )
+    config.add_view(view=ServerInfo, route_name="server_info", attr="html",
+                    renderer="server_info.mako", accept="text/html")
+    config.add_view(view=ServerInfo, route_name="server_info", attr="json", renderer="json",
+                    accept="application/json")
 
     # MAP ROUTES
-    config.add_route("map_index",      "/maps")
-    config.add_view(map_index,      route_name="map_index",      renderer="map_index.mako")
-
-    config.add_route("map_index_json", "/maps.json")
-    config.add_view(map_index_json, route_name="map_index_json", renderer="jsonp")
+    config.add_route("map_index", "/maps")
+    config.add_view(view=MapIndex, route_name="map_index", attr="html",
+                    renderer="map_index.mako", accept="text/html")
+    config.add_view(view=MapIndex, route_name="map_index", attr="json", renderer="json",
+                    accept="application/json")
 
     config.add_route("map_info",      "/map/{id:\d+}")
     config.add_view(map_info,      route_name="map_info",      renderer="map_info.mako")