/usr/share/doc/python-nevow/examples/manualform/manualform.py is in python-nevow 0.14.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 29 30 31 32 33 34 | # Demonstrates one way of manually handling form post. This example uses a
# "pretend" segment, _submit, for the form to post to (the action attribute).
from nevow import loaders, rend, tags as T, url
SUBMIT = '_submit'
class Page(rend.Page):
addSlash = True
def locateChild(self, ctx, segments):
# Handle the form post
if segments[0] == SUBMIT:
# Just print out the name
print '*** name:', ctx.arg('name')
# Redirect away from the POST
return url.URL.fromContext(ctx), ()
return rend.Page.locateChild(self, ctx, segments)
docFactory = loaders.stan(
T.html[
T.body[
T.form(action=url.here.child(SUBMIT), method="post")[
T.label['Name:'], T.input(type="text", name="name"),
],
],
]
)
|