]>
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 mirrors
= self
.mirrors
.list()
12 self
.render("mirrors.html", mirrors
=mirrors
)
15 class MirrorItemHandler(BaseHandler
):
17 mirror
= self
.mirrors
.get(id)
19 raise tornado
.web
.HTTPError(404)
21 ip
= socket
.gethostbyname(mirror
.hostname
)
22 mirror
.location
= self
.geoip
.get_all(ip
)
24 # Shortcut for coordiantes
25 mirror
.coordiantes
= "%s,%s" % \
26 (mirror
.location
.latitude
, mirror
.location
.longitude
)
28 # Nice string for the user
29 mirror
.location_str
= mirror
.location
.country_code
30 if mirror
.location
.city
:
31 mirror
.location_str
= "%s, %s" % \
32 (mirror
.location
.city
, mirror
.location_str
)
34 self
.render("mirrors-item.html", item
=mirror
)
37 class MirrorHandler(BaseHandler
):
39 self
.redirect("mirrors/all")
42 class MirrorAllHandler(BaseHandler
):
44 self
.render("downloads-mirrors.html", mirrors
=self
.mirrors
.list())
47 class MirrorDetailHandler(BaseHandler
):
49 self
.render("download-mirror-detail.html", mirror
=self
.mirrors
.get(id))