]> git.xonotic.org Git - xonotic/xonstat.git/blobdiff - xonstat/__init__.py
Convert the server info to a class-based view callable. Add a dummy JSON view.
[xonotic/xonstat.git] / xonstat / __init__.py
index 961aa3d253075fbd5f2ff28c4e0d21853fe55b13..b925989c2be691d0e948cebcf16d769f5b978ae4 100644 (file)
@@ -150,11 +150,21 @@ def main(global_config, **settings):
         accept="text/json"
     )
 
-    config.add_route("server_info",      "/server/{id:\d+}")
-    config.add_view(server_info,      route_name="server_info",      renderer="server_info.mako")
-
-    config.add_route("server_info_json", "/server/{id:\d+}.json")
-    config.add_view(server_info_json, route_name="server_info_json", renderer="jsonp")
+    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"
+    )
 
     # MAP ROUTES
     config.add_route("map_index",      "/maps")