summaryrefslogtreecommitdiff
path: root/web/main.py
blob: b7501c5cf971bb65a49495b3f5a6e454bc765b2b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env python2.6

from flask import Flask

from with_xml import Node

app = Flask(__name__)

@app.route('/')
def index():
    content = Node()
    tag = content.tag
    put = content.put
    a = tag('a')
    with tag('html'):
        with tag('head'):
            with tag('title'):
                put('Title')
        with tag('body'):
            with tag('h1'):
                put('Header')
            put('This is ')
            with a(href='http://google.com/'):
                put('a link to Google.')
    return str(content)

if __name__ == '__main__':
    app.run(debug=True)