[Twisted-web] using freeform bind_* instead of subclass TypedInterface

Paul Reznicek maillists at ivsn.com
Sat Jul 16 05:47:35 MDT 2005


Hello all,
using "bind_*" is very simple, nice and usable (try the example),
but I have several questions (see below):
# -------------------------------------------------------------------
from nevow import loaders
from nevow import rend
from nevow import tags as T

from formless import annotate
from formless import webform

class TestForm(rend.Page):
     addSlash = True
     def bind_two_fields(self, ctx):
         return [
             ('search', annotate.String(default='any text', label='Enter search string '), ),
             ('lines', annotate.Choice([10, 20, 30, ], default=20, label='set lines per page '), ),
             ('left', annotate.Button(label='<-'), ),
             ('right', annotate.Button(label='->'), ),
             ]

     def two_fields(self, **kwargs):
         print 'two_fields **kwargs:', kwargs

     docFactory = loaders.stan(T.html[T.body[webform.renderForms(), ] ] )

from nevow import appserver
from twisted.internet import reactor
reactor.listenTCP(8080, appserver.NevowSite(TestForm()))
reactor.run()
# -------------------------------------------------------------------

1. how to omit the automatically generated submit button "Call"
2. how to change (or skip) the displayed form name "Two _fields", resp. the whole frame ?
3. how to get all fields and buttons into one line, resp. one table row ?

Thanks for all hints and also for Nevow and Twisted!!!
Paul



More information about the Twisted-web mailing list