]> git.ipfire.org Git - ipfire.org.git/blame - src/web/mirrors.py
mirrors: Divide list by country
[ipfire.org.git] / src / web / mirrors.py
CommitLineData
95483f04
MT
1#!/usr/bin/python
2
3import tornado.web
4
5from . import base
6
7class IndexHandler(base.BaseHandler):
8 def get(self):
7a9e9176
MT
9 mirrors = self.backend.mirrors.get_by_countries()
10 if not mirrors:
11 raise tornado.web.HTTPError(404)
12
13 self.render("mirrors/index.html", mirrors=mirrors)
95483f04
MT
14
15
16class MirrorHandler(base.BaseHandler):
17 def get(self, hostname):
18 mirror = self.mirrors.get_by_hostname(hostname)
19 if not mirror:
20 raise tornado.web.HTTPError(404, "Could not find %s" % hostname)
21
22 self.render("mirrors/mirror.html", mirror=mirror)