pvl/verkko/web.py
changeset 1 731d2df704f0
parent 0 91c739202f06
child 3 5990b188c54b
equal deleted inserted replaced
0:91c739202f06 1:731d2df704f0
       
     1 from werkzeug.wrappers import Response
       
     2 
     1 # view
     3 # view
     2 from pvl.html import tags as html
     4 from pvl.html import tags as html
     3 
     5 
     4 def render_layout (title, content) :
     6 def render_layout (title, content) :
     5     css = [
     7     css = [
     6         "/static/layout.css", 
     8         "/static/layout.css", 
     7         "/static/style.css", 
     9         "/static/style.css", 
     8     ]
    10     ]
     9 
    11 
    10     return html.document(html.html(
    12     return unicode(html.document(html.html(
    11         html.head(
    13         html.head(
    12             html.title(title),
    14             html.title(title),
    13             (
    15             (
    14                 html.link(rel='Stylesheet', type="text/css", href=src) for src in css
    16                 html.link(rel='Stylesheet', type="text/css", href=src) for src in css
    15             ),
    17             ),
    16         ),
    18         ),
    17         html.body(
    19         html.body(
    18             html.h1(title),
    20             html.h1(title),
    19             content 
    21             content 
    20         )
    22         )
    21     ))
    23     )))
    22 
    24 
       
    25 def render_index () :
       
    26     return Response(render_layout("Verkko", (
       
    27         html.ul(
       
    28             html.a(href='/hosts')("DHCP Hosts"),
       
    29         )
       
    30     )), content_type='text/html')
    23 
    31