From: Ant Zucaro Date: Sun, 16 Oct 2016 14:22:59 +0000 (-0400) Subject: Add docstrings. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=06c64e0c2b1cea4da309306788c041c049e70c44;p=xonotic%2Fxonstat.git Add docstrings. --- diff --git a/xonstat/views/server.py b/xonstat/views/server.py index 1baeac1..4145c4b 100644 --- a/xonstat/views/server.py +++ b/xonstat/views/server.py @@ -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], }