from werkzeug.routing import Map, Rule
def rule (string, endpoint, **opts) :
return Rule(string, endpoint=endpoint, **opts)
# URL -> Handler
from pvl.verkko import hosts
# index page here :)
from pvl.verkko import web
class Index (web.Handler) :
def render (self) :
html = web.html
return (
html.ul(
html.li(
"DHCP Hosts",
html.ul(
html.li(html.a(href=self.url(hosts.ListHandler, **opts))(title)) for title, opts in hosts.ListHandler.VIEWS
)
),
)
)
urls = Map((
rule('/', Index),
rule('/hosts/', hosts.ListHandler),
rule('/hosts/<int:id>', hosts.ItemHandler),
))