It would be really nice to be *able* to create a template loader that can use the request object. If, for instance, you have a site that needs to be able to change the template used based on user preferences or based on the current Site object, it's a lot cleaner to be able to do that once in a custom template loader than to have to write (or inherit) that into every single view -- especially once you start integrating third-party apps with their own not-necessarily-class- based views.
On Nov 10, 6:27 am, Tom Evans <tevans...@googlemail.com> wrote: > On Thu, Nov 10, 2011 at 10:20 AM, Florian Apolloner > > > > > > > > > > <f.apollo...@gmail.com> wrote: > > Hi, > > > On Thursday, November 10, 2011 10:43:01 AM UTC+1, Tom Evans wrote: > > >> Please no - an optional argument is all well and good, until people > > >> I don't get why it is difficult to extract what you want from the > > >> request, place it in a context and render it. > > > I think you missunderstood me, I didn't ment to add a optional keyword > > argument like request, but pass **kwargs down the chain -- The current > > template loaders would just ignore it completly but users might override it > > to supply extra data to their template loader. Either way it was just a > > suggestion and I am not really sold on it either… > > > Cheers, > > Florian > > I tend to lurch from one extreme to another - I've calmed down a little now! > > I worry about coupling things to the request, having used frameworks > where that has happened over time. It always leads to problems down > the line, as in my experience, a lot of what happens on a web site > happens outside of the request/response cycle. > > It's already pretty hard to generate the same content outside of a > request/response if your template expects things from > TEMPLATE_CONTEXT_PROCESSORS. > > Cheers > > Tom -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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.