[Twisted-web] formless problem

James Y Knight foom at fuhm.net
Fri Jan 7 09:32:07 MST 2005

On Jan 7, 2005, at 8:50 AM, Eric Faurot wrote:

>> I wrote this simple app, where the RootPage has only a single
>> child, named 'form'. This child 'FormBuilder' is directly taken from
>> formbuilder.py in the example directory of last svn Nevow.
>> The child is correctly rendered but when I try to add an element
>> to the form, it doesn't appear (the formbuilder example work well
>> if a try the Nevow example).
>> Any help?
> Because you always return a new formbuilder when accessing child_form.
> So modifications are lost after the request is processed.
> You must keep it in the user session somehow.

Or if you want to be like the original example, where the form is 
global for all users, make the FormBuilder instance once, and always 
return the same thing. There's lots of ways you could do that, but the 
easiest way is:
-    def child_form(self, ctx):
-        return FormBuilder()
+    child_form = FormBuilder()


More information about the Twisted-web mailing list