﻿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
12063	Ensure SITE_CACHE uses integers as key values	Patryk Zawadzki	nobody	"Currently {{{django.contrib.sites.models.SiteManager.get_current}}} just takes whatever value {{{SITE_ID}}} is set to and shoves it into the cache. This leads to strange results if you replace the integer value with a proxy object that implements {{{__int__()}}}.

Whenever you want to return a different value at runtime (say you want to serve different content depending on the time of day or the hostname), you currently have to clear the cache as you end up with the following {{{dict}}}:

{{{
SITE_CACHE = {
    <Your proxy object>: <The first Site object ever used>,
}
}}}

The second time Django will just use the cache (as the proxy is equal to itself even if the value returned by {{{__int__()}}} changed).

Yes, I know altering settings at run time is not really encouraged but being able to proxy SITE_ID and alter the value using middleware is useful when dealing with dynamic subdomains (like customer1.example.com) and the change is both tiny and backwards-compatible."		closed	Contrib apps	1.1		wontfix			Unreviewed	1	0	0	0	0	0
