On 03/25/2013 09:25 PM, meric wrote:
> Previous discussion: 
> https://groups.google.com/forum/?fromgroups=#!searchin/django-developers/dynamic$20sites/django-developers/QSXLGSxy7Vk/TxgiJzz5nd8J
> https://code.djangoproject.com/ticket/16983
> https://code.djangoproject.com/ticket/4438

If you're interested in this area, you should review
https://code.djangoproject.com/ticket/15089 and
https://groups.google.com/forum/?fromgroups=#!topic/django-developers/4jw79p76uUo
- as far as I'm aware, that ticket/thread represent the farthest
anyone's gotten towards a specific proposal for handling dynamic
multitenancy with contrib.sites.

> My proposal allows getting the current site based on request.get_host(),
> without changing settings.SITE_ID, and maintaining backwards compatibility.
> 
> Required code changes: http://dpaste.com/1035045/
> 
> I propose adding an optional `request` argument to
> Site.objects.get_current(), so that:
> 
> `Site.objects.get_current()` returns current `Site` based on
> settings.SITE_ID
> `Site.objects.get_current(request)` returns current `Site` based on
> request.get_host()
> 
> Both conditional branches will be cached in SITE_CACHE.
> 
> The current changes I've proposed means if there is no site with domain
> == request.get_host(), it won't be able to get the current site. An
> alternative would be to fall back onto using settings.SITE_ID.
> 
> What do you think?

So it seems that basically this proposal just provides a way for user
code to get a Site instance by request host; it doesn't address the
issue of Django internally getting the current site using
settings.SITE_ID only (since even with this patch, Django would never
internally pass the request and get the new behavior).

If that's the extent of the benefit (a new way for user code to get the
current site), then I don't see the reason to complicate the behavior of
the existing functions with new optional arguments; rather just add a
new and separate Site.objects.get_current_for_request or similar. That
makes sense to me as a first step.

Carl

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to