On Wed, Feb 8, 2012 at 12:41 AM, Jonathan Vanasco <[email protected]> wrote: > This was driving me crazy for a while. Finally i realized that > Pyramid doesn't send any SetCookie commands when a redirect is called, > because the HTTPFound is oblivious to the request. > > It's not entirely recommended to set cookies with a redirect as not > all browsers accept them ( only Safari doesn't ) , however it is > common practice to encounter it... and I have some legacy code to > maintain / transition. > > I ended up with a workaround : > headers [ (k,v) for (k,v) in > self.request.response.headers.iteritems() if k == 'Set-Cookie'] > return HTTPFound(location='/account/redirect- > test-2',headers=headers) > > Does anyone know why "requests" were omitted from the > httpexceptions ? I just find it odd that there isn't a 'request' arg > on them , and that something like this isn't automatic. >
Not me. But I guess that you can use: resp = HTTPFound(location='/account/redirect-test-2') return self.request.response.merge_cookies(resp) > -- > You received this message because you are subscribed to the Google Groups > "pylons-discuss" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/pylons-discuss?hl=en. > -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
