[Django] #23661: Site cache doesn't cache in a per-database basis

8 views
Skip to first unread message

Django

unread,
Oct 15, 2014, 12:44:58 PM10/15/14
to django-...@googlegroups.com
#23661: Site cache doesn't cache in a per-database basis
-------------------------------+--------------------
Reporter: Kronuz | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.6
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
The cache for `Site` (`SITE_CACHE`) should cache site objects for the
database the object comes from. If there is a router in place and the
current site is retrieved from one database, a second call for getting the
current site from a different database will return the wrong object for
that database.

Instead of using `SITE_CACHE` the way it's currently done, I propose using
the same caching scheme as the one used in `ContentType`'s `_cache`.

--
Ticket URL: <https://code.djangoproject.com/ticket/23661>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 17, 2014, 9:49:47 AM10/17/14
to django-...@googlegroups.com
#23661: Site cache doesn't cache in a per-database basis
-------------------------------+--------------------------------------

Reporter: Kronuz | Owner: nobody
Type: Uncategorized | Status: new
Component: contrib.sites | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by timgraham):

* needs_docs: => 0
* component: Uncategorized => contrib.sites
* needs_tests: => 0
* needs_better_patch: => 0


Comment:

I'm not sure I understand the problem completely. Are you saying that in
database A you could have `(site_id=1, domain=example.com)` and in
database B `(site_id=1, domain=example2.com)`? Could you expand a bit on
the use case and how you ran into this?

--
Ticket URL: <https://code.djangoproject.com/ticket/23661#comment:1>

Django

unread,
Oct 21, 2014, 12:04:54 PM10/21/14
to django-...@googlegroups.com
#23661: Site cache doesn't cache in a per-database basis
-------------------------------+--------------------------------------
Reporter: Kronuz | Owner: nobody
Type: Uncategorized | Status: closed
Component: contrib.sites | Version: 1.6
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by timgraham):

* status: new => closed
* resolution: => needsinfo


Comment:

As discussed in IRC, #15089 may solve the use case here (allowing lookup
of the current site based on request.get_host()). If not, we need to
decide whether we'd officially support this particular configuration of
contrib.sites. While caching the site based on database seems valid, I'm
opposed to adding complexity unless there's a valid use case.

--
Ticket URL: <https://code.djangoproject.com/ticket/23661#comment:2>

Reply all
Reply to author
Forward
0 new messages