>
> There are a few different suggestions in this [1] stack overflow
> question. Since request.COOKIE['session'] didn't work, you might try
> one of the others.
>
> [1]http://stackoverflow.com/questions/526179/in-django-how-can-i-find-ou...
That was very helpful, Xiong. Thanks. I'm getting closer!
So I was able to get the SessionID (and it makes sense it's not in the
request object at the point that I was checking before). The code
that gave me the key was:
aSessionId = request.session.session_key
I then created a HttpResponse object and set the sessionid as a header
in the response. But unfortunately, this seems to get "tossed out"
before it gets to the client. My code that sets up the response
follows:
aResponse = HttpResponse()
aResponse[settings.SESSION_COOKIE_NAME] = aSessionId
logging.debug(str(aResponse._headers))
return aResponse
I print out the headers so I can make sure that the values are set
correctly. I get the following output:
{'sessionid': ('sessionid', '33ad89a8e16661df5f1f0fa77fbb795d'),
'content-type': ('Content-Type', 'text/ht
ml; charset=utf-8')}
I'm a bit surprised by the sessionid value in the dictionary. It
seems to be returning a list, not a string as I expected. (Note: I
tested by setting another header value and it did the same 'strange'
thing)
The problem is that the client isn't getting any header value I set in
the response. I'm getting the content type and charset headers, but
I'm not getting any of my header values sent down. Anything I'm just
not doing right - or are things being "pre-processed" before sent
down?
Note: I tried to use 'set_cookie()' on the HttpResponse but nothing
was visible nor was anything sent down to the client.
Thanks again for everyone's help. This has been very helpful so far.
--jarmo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" 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/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---