Mike Malone wrote:
> On Tue, Dec 8, 2009 at 7:52 PM, Russell Keith-Magee
> <freakboy3...@gmail.com> wrote:
>>  4. I share Mike's concern about using settings.SITE_ID to determine
>> the current host, but I'm not sure I have any suggestions on how we
>> could practically use request, short of encouraging the use of a
>> template tag like {% obj_url %} that can use data from the request
>> context if it is available.
> 
> It's not exactly pretty, but: http://paste.pocoo.org/show/155827/

All these are variations of the same thing: making request object 
global. Do we really want it?

For one thing it breaks what Django has always got right: being able to 
work in a script outside of a web request loop. So relying on 
contrib.Site may be inconvenient but it's way better than a global 
request. What I take from code like this:

     protocol = getattr(settings, "PROTOCOL", "http")
     domain = Site.objects.get_current().domain
     port = getattr(settings, "PORT", "")

... is not that we should get all these from a request but that we 
should add "protocol" and "port" fields to the Site model.

--

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


Reply via email to