File: form.py

package info (click to toggle)
albatross 1.36-5.4
  • links: PTS
  • area: main
  • in suites: squeeze, wheezy
  • size: 2,472 kB
  • ctags: 1,822
  • sloc: python: 7,437; makefile: 148; sh: 132
file content (27 lines) | stat: -rw-r--r-- 669 bytes parent folder | download | duplicates (5)
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
#!/usr/bin/python
from albatross import SimpleApp
from albatross.cgiapp import Request


class Form:

    def page_enter(self, ctx):
        ctx.locals.text = ctx.locals.singleton = ctx.locals.group = \
                          ctx.locals.radio = ctx.locals.select = None
        ctx.locals.num = 0
        ctx.add_session_vars('num')

    def page_display(self, ctx):
        ctx.locals.num += 1
        ctx.run_template('form.html')


app = SimpleApp(base_url='form.py',
                template_path='.',
                start_page='form',
                secret='-=-secret-=-')
app.register_page('form', Form())


if __name__ == '__main__':
    app.run(Request())