[Zope] (no subject)

Travis Miller travis at ctln.org
Wed Aug 25 08:23:40 EDT 2004


hi,

On Aug 25, 2004, at 5:08 AM, lists at christof-doerflinger.de wrote:

> Hello,
>
> I have seen this in an example to redirect from a Script to a Page  
> Template:
>
> return container.index_html(REQUEST)
>
> It seems like this sends the REQUEST variable to the index_html.

this returns the output the page template directly from the request for  
the script.

> I would like to use
>
> return
> context.REQUEST.RESPONSE.redirect(getattr(context,"add.html").absolute_ 
> url())

this will return an http redirect 30x response with the given url to  
the browser, which then re-requests that url. (not sure what the  
default redirect response is..307-temporary? ..302-permanent?  
..something else?)

> because there is a point character in my id (add.html).
> Does the "context.REQUEST.RESPONSE.redirect" send the REQUEST variable  
> to my
> add.html, too?

no, because the browser is making a completely new request for the  
passed url.

> Or do I have to send an object id with this redirect like:
>
> return
> context.REQUEST.RESPONSE.redirect(getattr(context,"add.html").absolute_ 
> url()) +
> "?id=" + myID

almost...

return context.REQUEST.RESPONSE.redirect( getattr(context,  
'add.html').absolute_url()+'?id='+myID )

thats one way to do it, or you could set the id variable in the request  
object before you called the first example.

context.REQUEST.set('id', myID)
return container.index_html(context.REQUEST)


thanks,
travis



More information about the Zope mailing list