Add server index and template. Fix links on player index and template.
[xonotic/xonstat.git] / xonstat / views / server.py
index 1df6f248cacd7f643be8a385336fb6ec859f376e..e0dce91cf1bdde8e47b9c93c835b47a7e415d045 100755 (executable)
@@ -9,6 +9,27 @@ from xonstat.util import page_url
 \r
 log = logging.getLogger(__name__)\r
 \r
+def server_index(request):\r
+    """\r
+    Provides a list of all the current servers. \r
+    """\r
+    if 'page' in request.matchdict:\r
+        current_page = request.matchdict['page']\r
+    else:\r
+        current_page = 1\r
+\r
+    try:\r
+        server_q = DBSession.query(Server).\\r
+                order_by(Server.name)\r
+\r
+        servers = Page(server_q, current_page, url=page_url)\r
+\r
+        \r
+    except Exception as e:\r
+        servers = None\r
+\r
+    return {'servers':servers, }\r
+\r
 \r
 def server_info(request):\r
     """\r