ASDF {{ request.session }} <br />
<ul>
{% for k,v in request.session.items %}
<li>{{ k }} |value={{ v }}</li>
{% endfor %}
</ul>
######################
ASDF <django.contrib.sessions.backends.cache.SessionStore object at 0x24ddc90>
- customer |value=willa01
- _auth_user_id |value=11
- _auth_user_backend |value=safeavenue.util.auth.IframeAuthBackend
- token |value=a03ff6c580
- operator |value=gtn
- cookie_path |value=/iframe/gtn/cs/willa01/a03ff6c580/
##########################
request.session.session_key
ASDF {{ request.session.session_key }} <br />
This works.
request.session.items IS DIFFERENT from request.session.session_key.
and the latter is accessible in the TEMPLATE (after session middleware->process_response.
in
C:\Python26\Lib\site-packages\django\contrib\sessions\middleware.py
Line 38:
response.set_cookie(settings.SESSION_COOKIE_NAME,
request.session.session_key, max_age=max_age,
OBJECTIVE: You wanted to get the session key in the template, so that you can set it using jQuery plugin,
because IE7 couldn't set it for an iframed page.
#############################
The below snippet doesn't work in the view.py code, as the process_response session middleware has not yet been invoked.
## session_key = request.COOKIES[p3p.SESSION_COOKIE_NAME]
print "zzz", request.COOKIES
for key in request.COOKIES:
print "aaa", request.COOKIES.get(key)
## print "session_key", session_key
print "End"
The result: it prints a lot of Nothing.
No comments:
Post a Comment