Hi Carlton,
Thanks for taking the time to investigate. I specifically tried to generalize for this forum as I believe the underlying behaviour for which I am proposing change is fundamental enough to warrant attention but this group.
My specific use case involves allauth and dbtemplates, two pip packages that I have run together with SITE_ID set. I am expanding, or attempting to, to support 'ephemeral sites', which can be skinned via templates stored in dbtemplates. So just remove SITE_ID, right?
That would be the case if dbtemplats supported request based site lookup, however the template loader portion really cannot and shouldn't be burdened with request context as it can and should be accessible without it. So, I either 'down-shift' to SITE_ID and gear up on processes, or I look for a code solution, which is more fun for me :) As always, there are many ways to remove the fur from a feline.
One real-world example of what I hope to be ablate achieve would be support a team or Realtors (tm) who purchase domains for each property sold, with the potential to skin each according to the domain. I fired up dbtemplates which has a lot of good stuff, but run in to the fact that it requires SITE_ID. Yes, I am also pursuing the 'fix dbtemplates' route, or find something else, or make it myself, but experience says that this will not be the last time I or others try to pull in pieces that conflict. I believe this proposal would provide a means of resolution in which none of the packages need to be tweaked to get them to play nicely together when one makes valuable use of request by site and another does not allow it.
I posted (not yet approved) a companion topic to django-users for the purposes of how to work with this for existing releases, best practices for 'overloading' django and apps, etc. (running with patches / tweaks, etc). I can tweak up dbtemplates to not call for get_current() if no SITE_ID is present, but return a configuration, I can tweak up django and run a fork.
To bring this back around to justification for a change to such a large install base based on my current understanding:
- These two modes of operation for site managers are incompatible.
- pip is one of the top for repos and django is a major player in that space - the number of django packages is impressive. I see the rear-view roadmap as a natural progression and the addition of the request mech as a good example of 'first do no harm'. However now that we have had two for a while, I will not be the last person to try to move from SITE_ID to request based sites and find packages that don't play together nicely. At least I don't think I'm that unique.
- The change is designed to continue wit the 'first do no harm' strategy, so the first requirement is that all existing settings files in the install base work with exactly the same behaviour as previously. I believe this is baked in to the suggested implementation.
I'm actually surprised that I didn't 'We decided XYZ back in ticket 123'.
I hope I am not just missing something fundamental, I am not an expert with this framework by any stretch of the imagination, mine included. The specific behaviour does seem to be quite limited in scope, however. You either do or do not have SITE_ID - if you have it, you get SITE_ID even if you pass in request. If you do not have SITE_ID, then you MUST pass request, or an exception is thrown. Never shall the twain meet, unless you have another piece of information and another check.
That much seems very isolated. The ability to allow one portion of code to get some default site id while allowing others to get the the id based on the request seems like a reasonable enough thing to want to do when generalized. At least that't the way it seems to me, so I thought I would offer these puny few lines of code back with gratitude for the multitudes of code that came before.
Again, thank you for your consideration and all of the work done by everyone.
Regards,
Ira