﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
26764	Session.cycle_key() throws Exception if the session hasn't been accessed	adam-iris	Adam Zapletal	"A common use case I see is that a user changes some content then tries to view their changes on the website, but they get an older, previously-cached page.

Since the page-level cache key uses the session id, my solution is to call `request.session.cycle_key()`. To the user this is presented as a ""hard reload"" -- it clears the session key then redirects back to the current page, the page-level cache will miss and the user will get a newly-generated version.

However, this raised an exception:
{{{ 'SessionStore' object has no attribute '_session_cache' }}}

Upon inspection, it looks like `SessionBase._session_cache` doesn't get initialized except by calling `SessionBase._session`. But the `cycle_key()` method accesses `_session_cache` without ensuring that it's been initialized.

My workaround was to prepend a meaningless access call:

{{{
request.session.get('foo')
request.session.cycle_key()
}}}

This fixed the exception, but I think the proper fix is for `cycle_key()` to initialize (or more carefully check) `_session_cache`."	Cleanup/optimization	closed	contrib.sessions	1.8	Normal	fixed			Accepted	1	0	0	0	0	0
