pvl/verkko/web.py
author Tero Marttila <terom@paivola.fi>
Wed, 10 Oct 2012 21:59:34 +0300
changeset 1 731d2df704f0
parent 0 91c739202f06
child 3 5990b188c54b
permissions -rw-r--r--
fixup index + non-chunked response (?) + hosts + evil hardcoded db url
from werkzeug.wrappers import Response

# view
from pvl.html import tags as html

def render_layout (title, content) :
    css = [
        "/static/layout.css", 
        "/static/style.css", 
    ]

    return unicode(html.document(html.html(
        html.head(
            html.title(title),
            (
                html.link(rel='Stylesheet', type="text/css", href=src) for src in css
            ),
        ),
        html.body(
            html.h1(title),
            content 
        )
    )))

def render_index () :
    return Response(render_layout("Verkko", (
        html.ul(
            html.a(href='/hosts')("DHCP Hosts"),
        )
    )), content_type='text/html')