Re: #14770: Set cookies from request: Design decision needed

2010-11-24 Thread Paul McLanahan
On Wed, Nov 24, 2010 at 4:20 PM, Jacob Kaplan-Moss wrote: > Okay, I think we're narrowing in on things. Just so I'm clear, you've > got a view that sets a message towards the beginning and then displays > that message in the template *on the very same request*, yes? Basically, yes. > So in essen

Re: #14770: Set cookies from request: Design decision needed

2010-11-24 Thread Jacob Kaplan-Moss
On Wed, Nov 24, 2010 at 3:01 PM, Paul McLanahan wrote: > I need to call a function > from a view that needs to be able to set messages and potentially set > other cookies. I need the request object to set the messages, and the > response to set the cookies. This is already confusing in my opinion

Re: #14770: Set cookies from request: Design decision needed

2010-11-24 Thread Paul McLanahan
Thanks for that example Ian. That's exactly it. I'm doing it from a view decorator, but in effect it's the same. I need to call a function from a view that needs to be able to set messages and potentially set other cookies. I need the request object to set the messages, and the response to set the

Re: #14770: Set cookies from request: Design decision needed

2010-11-24 Thread Ian Kelly
On Wed, Nov 24, 2010 at 1:11 PM, Jacob Kaplan-Moss wrote: >> In my >> case I was creating a small framework for registering functions that >> would check for and set messages via the messages framework. If I >> called the view and passed the request and response to these >> functions, the messages

Re: #14770: Set cookies from request: Design decision needed

2010-11-24 Thread Jacob Kaplan-Moss
On Wed, Nov 24, 2010 at 1:50 PM, Paul McLanahan wrote: > There are just situations where you need to have the ability to cause > a cookie to be set, but can't yet create the response object. Okay, but you've said this twice without giving any examples. Which makes it very easy for me to argue tha

Re: #14770: Set cookies from request: Design decision needed

2010-11-24 Thread Paul McLanahan
On Wed, Nov 24, 2010 at 2:23 PM, Jacob Kaplan-Moss wrote: > Ugh, I'm -1 on this. It confuses requests and responses, and abstracts > away a *very* important aspect of how HTTP actually works. Doing this > is semantically unclean and binds together two parts of the > request/response cycle that are

Re: #14770: Set cookies from request: Design decision needed

2010-11-24 Thread Jacob Kaplan-Moss
On Wed, Nov 24, 2010 at 12:31 PM, Paul McLanahan wrote: > I created ticket #14770 (http://code.djangoproject.com/ticket/14770) > because I ran into a situation this week where I only had access to > the request, but needed to set a cookie. As the ticket says, I did > solve this problem with a midd

#14770: Set cookies from request: Design decision needed

2010-11-24 Thread Paul McLanahan
Hi all, I created ticket #14770 (http://code.djangoproject.com/ticket/14770) because I ran into a situation this week where I only had access to the request, but needed to set a cookie. As the ticket says, I did solve this problem with a middleware, but I couldn't think of a reason not to include