[Zope] How to use RESPONSE.redirect ?

Kapil Thangavelu kthangavelu@earthlink.net
Wed, 16 Aug 2000 03:48:44 -0700


"R. David Murray" wrote:
> 
> On Tue, 15 Aug 2000, Kapil Thangavelu wrote:
> > #example call to above
> > #<dtml-call "RESPONSE.redirect(URL1+'?'+url_encode_form_vars(_))">
> 
> If your original form submits using the GET method, then QUERY_STRING
> will contain the already URL encoded parameters that the browser
> sent originally.

True. However, the GET method is of limited utility which is not
appropiate for many situations mainly because of size constraints.
Examples, file upload, most anything with text area, stuff with a user
passwd. Granted the above example is something that is going to stick
the whole thing in the URL anyways. But the two python methods can be
used for both GETs and POSTs and if you use the second method
url_encode_vars you can pass it a  dict of only those values you want to
receive in the next page example.
<dtml-call "RESPONSE.redirect(url_encode_vars({'var1':var1,
'metoo':metoo}))">

> DTML also has a url_encode format you can use to cause a string to
> be url encoded if it isn't already.  Check the dtml reference.

been there, done that.

DTML fmts are useful only for inserting text into a page or link with a
<dtml-var > or the entity syntax. there are no functions that will
encode a var in a pythonish expression("") which is what you need when
doing this with a redirect. 


Cheers

Kapil