Gday folks,

I've written a middleware to add some session variables based on the
request variable; this is done in process_request, which always
returns None. I'd like to set some cookies as well, based on the same
session variables, which should be done in process_response. I wrote
the method, but found it was not dropping cookies, so I simplified it
some, here is my current version:

        def process_response(self, request, response):
            """Drop cookies based on whether a user has selected an
offer

            Always drop (refresh) the greencode cookie and RefCode
cookie
            Drop offer cookies based on whether the user has clicked-
through on
            an offer.

            """
            print "BAH!"
            #if request.session.get('grc'):
                #response.set_cookie('_gc', request.session['grc'],
315360000,
                    #domain=domain)
            #response.set_cookie('RefCode',
request.session['refcode'], 315360000,
                    #domain=domain)
            return response

This, unfortunately, doesn't print anything to the server log (either
when running the development server, or on an apache/mod_wsgi
environment). Even when I change response to an empty HttpResponse(),
I still get the response the view returned. So surely this all means
that the process_response method is not being called.

Does anyone have any suggestion as to why this might be happening, and
how to rectify it?

Thanks,
Brenton

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to