<html>
Thanx to the dude who answered my last post :)<br>
When i get some time i have to try and put into practive wxpython
suggestions<br><br>
I took the form processor example from the sandbox and made it do
something.<br>
What it is doing i am not quite sure :)<br><br>
#form_input.py<br>
#simple proggie to test how to handle forms<br>
#hacked together from myformstuf which is in the glyph directory in the
sandbox<br>
#not really sure if this is done right<br><br>
from twisted.web.woven import page<br>
#this module is required for the method def wmfactory_form(self,
request): to work<br>
from twisted.web.woven.form import FormProcessor<br>
from twisted.python import formmethod as fm<br><br>
class FormPage(page.Page) :<br><br>
template = '''<br>
<html><br>
<head><title>a form
page</title><br>
</head><br>
<body><br>
<form action="post"
model="form" /><br>
</body><br>
</html><br>
'''<br><br>
formSignature = fm.MethodSignature(<br>
fm.String("username","","User Name :
","Enter a user name"),<br>
fm.Password("password","","Password :
","Enter a password")<br>
)<br>
<br>
def proc(self,**kw) :<br>
print "proc :
",kw<br><br>
def wmfactory_form(self, request):<br>
print "factory
form"<br>
return
self.formSignature.method(self.proc)<br><br>
def wchild_post(self,request) :<br>
print "child post
",request.args<br>
return
FormProcessor(self.formSignature.method(self.proc))<br>
<br><br>
<br>
#the test throttle code<br>
def main() :<br>
print "Main Loop"<br>
from twisted.web.server import Site<br>
from twisted.internet import reactor<br><br>
reactor.listenTCP(9999,Site(FormPage()))<br>
reactor.run()<br><br>
main()<br><br>
self.proc is a required arguement.<br>
It returns a dictionary with all the form variables in it when form is
posted. <br>
I am not really sure what am i supposed to do in this function. Like in
this instance<br>
would this be where i could stick variables into a data base ?<br><br>
The method FormProcessor(self.formSignature.method(self.proc)) appears
from the code<br>
to be able to take a second arguement where i can add my own view. If no
view is added<br>
it uses the view that is provided by default. It would be kinda nice to
have my own view,<br>
how would my own view be able to access the variables that are posted
from the form.<br><br>
FormProcessor also appears to be able to take a 3rd arguement that is
some sort of error view,<br>
what type of errors would happen, and how will they be
triggered.<br><br>
FormProcessor looks like the smart way to handle forms. Unfortunately I
seem to be missing a few pieces.<br><br>
Well i will keep on plugging away at it :)<br>
Hmmmm well anyways i am kinda lost i will think about being lost some
more :))<br><br>
<br>
Thanx<br><br>
</html>