]> git.ipfire.org Git - ipfire.org.git/blob - src/web/location.py
location: Add latest relevant blog post
[ipfire.org.git] / src / web / location.py
1
2 #!/usr/bin/python
3
4 import logging
5 import tornado.web
6
7 from .. import util
8
9 from . import auth
10 from . import base
11
12 class IndexHandler(auth.CacheMixin, base.BaseHandler):
13 def get(self):
14 posts = self.backend.blog.get_by_tag("location", limit=1)
15
16 self.render("location/index.html",
17 address=self.current_address, posts=posts,
18 )
19
20
21 class LookupHandler(base.BaseHandler):
22 async def get(self, address):
23 # Lookup address
24 address = util.Address(self.backend, address)
25
26 self.render("location/lookup.html", address=address)
27
28
29 class BlacklistsHandler(base.BaseHandler):
30 async def get(self, address):
31 # Lookup address
32 address = util.Address(self.backend, address)
33
34 # Lookup blacklists
35 blacklists = await address.get_blacklists()
36
37 self.render("location/blacklists.html",
38 address=address, blacklists=blacklists)