There is now a ticket and a patch for this, which includes the utility method and a rollup of fixes for the aforementioned tickets as appropriate. Tests and docs included. Details are in the ticket description:
http://code.djangoproject.com/ticket/14386 I'd love to get some feedback on it when possible. Thanks! - Gabriel On Oct 1, 4:12 am, Luke Plant <l.plant...@cantab.net> wrote: > On Thu, 2010-09-30 at 23:48 -0700, Gabriel Hurley wrote: > > I went to triage a few tickets tonight, and noticed that #8960, > > #10235, #10608 and #13814 have all arrived at essentially the same > > conclusion: there needs to be a single idiomatic way to get either the > > current Site object if contrib.sites is installed, or a RequestSite > > object if not. All four tickets use the same bit of code, the argument > > really only lies in where to put it. > > > #10235 adds it as a utility function in contrib.sites.models, #13814 > > as a separate method on SiteManager, and #8960 and #10608 basically > > just copy and paste where needed. I'm of the opinion it should have > > its own home in contrib.sites, but where, and under what name? > > I think a stand-alone function in contrib.sites.models is fine, called > `get_current_site` (or some other sensible colour of your choosing). > Since both Site and RequestSite already live there, it seems a good > place. > > Thanks for your work on this, > > Luke > > -- > "Despair: It's always darkest just before it goes pitch black." > (despair.com) > > Luke Plant ||http://lukeplant.me.uk/ -- 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.