[Zope] Form POST Question (and a QUERY_STRING Q.)
Andrew H. Chatham
andrew.chatham@duke.edu
Thu, 01 Jun 2000 15:07:31 -0700
> Is there a way for me to get the raw posted data and forward that
> too via the RESPONSE object?
What I ended up doing was following Zen's suggestion and creating an
external method that basically does (not an exact quote; it's on another
computer):
def generateForm(self):
outForm = []
for (name, value) in self.REQUEST.form:
outForm.append ('<input type="hidden" name"%s" value="%s">' % (name,
value)
return string.join (outForm, '\n')
It's a little more than that, but I don't have it in front of me. (this
wouldn't deal with quotes right).
I haven't run into the name="mynum:int" problem yet, but maybe that's
just luck, or maybe it's just because of my particular forms. The bad
part is that I don't know of any way to pass POST data on a redirect
(anybody know how to do this, or is this impossible?), so for now I just
have a form that's nothing but a Submit widget with all the other dat a
hidden.
You can of course change it all into GET data and just join them
together using:
'%s=%s' % (url_quote_plus(name), url_quote_plus(data))
and joinging with &, in which case you actually can do a redirect, but
presumably someone made it POST for a reason, so I'm not going to mess
with it. It's an inelegant solution and might not work for everything,
but it's all I have for now!
Andrew