[Twisted-web] How works formless?

Alberto Trujillo alberto.trujillo at ucd.ie
Thu Jun 30 03:58:09 MDT 2005


Hello:
I was trying to follow this example but I'm a bit lost. I can see the 
form but when I submit the information I receive the next exepction 
error "global name request is not defined".
I don't know why formless has to be autocallable and where I must to 
defined "request"

Could anybody help me? Here are my files. I need to know what I have to 
do after submit the information.

year.tac
----------
from twisted.application import internet, service
from nevow import appserver
import year

application = service.Application("tasks")
webserver = internet.TCPServer(8080, appserver.NevowSite(year.Colorful()))
webserver.setServiceParent(application)

year.py
---------
from nevow import rend, loaders
import formless

class YearChooseable(formless.TypedInterface):
    def selectYear(self, year=formless.Integer()):
        pass
    selectYear = formless.autocallable(selectYear)


class Colorful(rend.Page):
    __implements__ = YearChooseable, rend.Page.__implements__


    def selectYear(self, year):
        self.test = True
        return rend.Page.locateChild(self, request, childSegments)

    docFactory = loaders.xmlfile("year.html")

year.html
----------
<form action="freeform_post!!selectYear" method="POST">
    Type a year: <input type="text" name="year" />
    <input type="submit" />
</form>




More information about the Twisted-web mailing list