]> git.rm.cloudns.org Git - xonotic/xonstat.git/commitdiff
Add docstrings.
authorAnt Zucaro <azucaro@gmail.com>
Sun, 16 Oct 2016 14:22:59 +0000 (10:22 -0400)
committerAnt Zucaro <azucaro@gmail.com>
Sun, 16 Oct 2016 14:22:59 +0000 (10:22 -0400)
xonstat/views/server.py

index 1baeac1295b63ae2ccdb2e6b539ba8a2febc9a83..4145c4b092e8cc4b02dd68de5c6060a4a4c0925c 100644 (file)
@@ -11,13 +11,17 @@ log = logging.getLogger(__name__)
 
 
 class ServerIndex(object):
+    """Returns a list of servers."""
 
     def __init__(self, request):
+        """Common parameter parsing."""
+
         self.request = request
         self.page = request.params.get("page", 1)
         self.servers = self._data()
 
     def _data(self):
+        """Returns the data shared by all renderers."""
         try:
             server_q = DBSession.query(Server).order_by(Server.server_id.desc())
             servers = Page(server_q, self.page, items_per_page=25, url=page_url)
@@ -28,11 +32,13 @@ class ServerIndex(object):
         return servers
 
     def html(self):
+        """For rendering this data using something HTML-based."""
         return {
             'servers': self.servers,
         }
 
     def json(self):
+        """For rendering this data using JSON."""
         return {
             'servers': [s.to_dict() for s in self.servers],
         }