Rather than creating a web.form.Form object and adding fields, it is also possible to define a custom form object. This has the advantage that you can easily override the default behaviour of the web.form.Form object so that your form will display information in a different way. More information on customising web.form.Form objects is given later on. The code below creates exactly the same form object as we created in the example above.
>>> class ExampleForm(web.form.Form): ... def setup(self): ... self.addField( ... field.Input( ... name='box', ... default='Default Text', ... description='Input Box:', ... size=14, maxlength=25 ... ) ... ) ... self.addAction('Submit') ... >>> exampleForm = ExampleForm(name='form', action='forms.py', method='get')