[Twisted-web] gronking nevow forms

Andy Gayton andy at thecablelounge.com
Sun Jun 27 02:21:44 MDT 2004

Hey there,

Just trying to get a handle on how forms in nevow work.

Reading through it looks like there are two main ways to express forms; 
as loose properties, and as methods - or:

class IUser_FormEdit(annotate.TypedInterface):
     name = annotate.String()
     age  = annotate.Integer()


class IUser_FormEdit(annotate.TypedInterface):
     def edit( self, name=annotate.String(), age=annotate.Integer() ):
     annotate.autocallable( edit )

Properties make it easy to present the existing values of an object - 
but as far as I can tell, they're a one per form kind of thing.  Methods 
on the other hand are good since as it's easy to throw a bunch of 
elements in a single form; but it looks horrible trying to load them up 
with existing data.

The only way I've found is in the pastebin example:

formDefaults = context.locate(iformless.IFormDefaults)
formDefaults.setDefault('editPasting.text', version.getText())
formDefaults.setDefault('editPasting.postedBy', version.getAuthor())

Is there a way to show more than one property in a form + have an action 
triggered when the property update is over?

Is there a more intuitive way of loading values into a method defined 
form than the pastebin example?


More information about the Twisted-web mailing list