[mod_python] Newbie needs help with forms

Jim binarybrain at phreaker.net
Sat Feb 14 08:52:24 EST 2004

I am new to modpython and I could use a hand with forms. I currently
have the publisher setup. The following snippit of code prints none of
the form vars that I (thought) I was passing. When I click submit test
gets loaded but the page is blank. I thought iterating through the keys
would work. What am I doing wrong here? 

TIA - Jim

from mod_python import apache, util
import HTMLgen
from HTMLgen import *

def test(req):
        html_page = HTMLgen.BasicDocument(title='Test')
        for i in util.FieldStorage(req).keys():
        return html_page
def handler(req):
        html_page = HTMLgen.BasicDocument(title='Register')
        f = Form('')
        f.append("Please pick a username and password")
        f.append(Input(type='textfield', name='username'))
        f.append(Input(type='password', name='passwd'))
        f = space(f)
        role = ['Official', 'Coach', 'Parent', 'Player']
        for choice in role:
                r = Input(type='radio', name='role', rlabel=choice)
        f.submit = Input(type='submit', value='register')
        return req

More information about the Mod_python mailing list