]>
git.ipfire.org Git - people/shoehn/ipfire.org.git/blob - www/webapp/handlers_mirrors.py
6 from handlers_base
import *
8 class MirrorIndexHandler(BaseHandler
):
10 ip_addr
= self
.get_argument("addr", self
.request
.remote_ip
)
12 # Get a list of all mirrors.
13 all_mirrors
= self
.mirrors
.get_all()
15 # Choose the preferred ones by their location.
16 preferred_mirrors
= all_mirrors
.get_for_location(ip_addr
)
18 # Remove the preferred ones from the list of the rest.
19 other_mirrors
= all_mirrors
- preferred_mirrors
21 self
.render("mirrors.html",
22 preferred_mirrors
=preferred_mirrors
, other_mirrors
=other_mirrors
)
25 class MirrorItemHandler(BaseHandler
):
27 _
= self
.locale
.translate
29 mirror
= self
.mirrors
.get(id)
31 raise tornado
.web
.HTTPError(404)
33 self
.render("mirrors-item.html", item
=mirror
)
36 class MirrorHandler(BaseHandler
):
38 self
.redirect("mirrors/all")
41 class MirrorAllHandler(BaseHandler
):
43 self
.render("downloads-mirrors.html", mirrors
=self
.mirrors
.list())
46 class MirrorDetailHandler(BaseHandler
):
48 self
.render("download-mirror-detail.html", mirror
=self
.mirrors
.get(id))