[Twisted-Python] change submodel in a form

vicky lupien vlupien at drummonddesigns.com
Fri Oct 31 09:52:25 EST 2003

I have a web base application.  I want to change the data in the model
so that it will be update in the form when a post my form.
Here's my code:
from twisted.web.server import Site
from twisted.internet import reactor
from twisted.web.woven.page import Page
from twisted.web.woven.form import FormProcessor
from twisted.python import formmethod as fm
from twisted.web.woven import input, controller
from twisted.web import domhelpers
class FormPage(Page):
    template = '''<html>
    <head><title>a form page</title>
    <body bgcolor="c0c0c0">
    <!--<div model="args" view="Text"/>-->
    <form action="post" method="post" enctype="multipart/form-data">
    <table border="0">
    <td align="right" valign="top">Argument #1:</td>
    <td valign="top"><input type="text" name="arg1" value="" size="60"
controller="int" />
    <div class="formDescription">Hooray it is an argument.
    <td align="right" valign="top">Integer Field.: *</td>
    <td valign="top"><input type="text" name="arg2" value=""/>
    <div class="formDescription">
    <td align="right" valign="top">TEXT PLS:</td>
    <td valign="top"><textarea wrap="virtual" rows="10" cols="60"
name="arg5">HERE IS THE DEFAULT OMG!@#!.</textarea>
    <div class="formDescription">it is some text
    </table><input type="submit" />
    def __init__(self):
    def checkName(self, request, name):
        if name is None:
            return None
        return True
    #def commitName(self, request, name=""):
    #    print self.model
    def wvupdate_arg1(self, request, widget, model):
    def wmfactory_arg1(self, request):
        return request.args.get('arg1')
    def wcfactory_int(self, request, node, model):
        self.submodel = self.model.getSubmodel(request, "arg1")
        return input.InputHandler(
            name = "arg1",
            check = self.checkName,
            submodel = self.submodel)
            #commit = self.commitName
    def wchild_post(self, request):
        return self
reactor.listenTCP(8585, Site(FormPage()))
Here's the error I get:
exceptions.TypeError: process() keywords must be strings
I know that the error comes from controller but I don't know how to
correct it.
Maybe the error is because I'm not very familiar with form.
Thx in advance,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20031031/a8eb7bef/attachment.htm 

More information about the Twisted-Python mailing list