﻿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
19254	clear_expired for Sessions With File Backend Throws Exception	Simon Blanchard	nobody	"The following line in clear_expired for file based sessions does not do what the author intended:

{{{
storage_path = getattr(settings, ""SESSION_FILE_PATH"", tempfile.gettempdir())
}}}

tempfile.gettempdir() will only be called if SESSION_FILE_PATH does not exist in settings. But it does exist and defaults to None. The exception occurs in the call os.listdir(storage_path).

What is probably required is this:

{{{
storage_path = getattr(settings, ""SESSION_FILE_PATH"", None)
if not storage_path:
    storage_path = tempfile.gettempdir()
}}}

or this:

{{{
storage_path = cls._get_storage_path()
}}}

"	Bug	closed	contrib.sessions	1.5-alpha-1	Release blocker	fixed	sessions filebackend	bnomis@…	Accepted	0	0	0	0	1	0
