[Zope] <dtml-var expr="RESPONSE.redirect Question

Paul Winkler pw_lists at slinkp.com
Thu Sep 11 16:00:40 EDT 2003


On Thu, Sep 11, 2003 at 11:40:39AM -0700, Dylan Reinhardt wrote:
> On Thu, 2003-09-11 at 11:34, Alexander Alvarado wrote:
> > Hi, this is adum question, but how can I include variables in the redirect 
> > expresion, I want to redirect to a page and at the same page send the 
> > variables what I want is something like this:
> > 
> > <dtml-var 
> > expr="RESPONSE.redirect('Disponibilidad?Arrival=The_value&Departure=The_value')">
> > 
> > Where The_value is a date sent from an other page...
> 
> Assuming that Disponibilidad resolves to a full URL (with http://) and
> The_value can be acquired, what you have should work.  
> 
> What errors/problems are you seeing?

I think he means that he wants to pass a variable rather than
the literal string "The_value."
Alexander, you just need a string argument to RESPONSE.redirect. 
Everythin in double-quotes above is a python expression, and it's easy to 
built a string out of variables in python.  You can use the + operator
to concatenate strings, or use the % operator to do printf-style formatting.
An example of the latter, assuming the variables are available in REQUEST:

 <dtml-var 
  expr="RESPONSE.redirect('Disponibilidad?Arrival=%s&Departure=%s' % (REQUEST['start_date'], REQUEST['end_date']))"> 

-- 

Paul Winkler
http://www.slinkp.com
Look! Up in the sky! It's PUMA GOAT!
(random hero from isometric.spaceninja.com)



More information about the Zope mailing list