Re: RFC: #12815/#12816 -- TemplateResponse and render() shortcut

2010-12-01 Thread Ivan Sagalaev
On 12/01/2010 05:05 PM, Łukasz Rekucki wrote: from django.conf import settings def without_localization(view): @wraps(view): def decorated(*args, **kwargs): # NOTE: I'm assuming this will actually have any effect - settings caching is a different issue old_value, sett

Re: RFC: #12815/#12816 -- TemplateResponse and render() shortcut

2010-12-01 Thread Łukasz Rekucki
On 1 December 2010 14:37, Ivan Sagalaev wrote: > On 12/01/2010 04:26 PM, Łukasz Rekucki wrote: >> >> What about view decorators? >> >> I don't want to invent use cases here, but if I right now have a view >> decorator that on it's way out changes something that could alter how >> a template is ren

Re: RFC: #12815/#12816 -- TemplateResponse and render() shortcut

2010-12-01 Thread Ivan Sagalaev
On 12/01/2010 04:26 PM, Łukasz Rekucki wrote: What about view decorators? I don't want to invent use cases here, but if I right now have a view decorator that on it's way out changes something that could alter how a template is rendered (like current language, some settings or the database conte

Re: RFC: #12815/#12816 -- TemplateResponse and render() shortcut

2010-12-01 Thread Łukasz Rekucki
On 1 December 2010 13:51, Ivan Sagalaev wrote: > On 12/01/2010 02:52 PM, Łukasz Rekucki wrote: >> >> Lots of people find render_to_response so verbose, that they are using >> direct_to_template() view instead. Django 1.3 deprecates that one, so >> it would be fair to offer those people a replaceme

Re: RFC: #12815/#12816 -- TemplateResponse and render() shortcut

2010-12-01 Thread Ivan Sagalaev
On 12/01/2010 02:52 PM, Łukasz Rekucki wrote: Lots of people find render_to_response so verbose, that they are using direct_to_template() view instead. Django 1.3 deprecates that one, so it would be fair to offer those people a replacement. Forcing them at the same time into the world of lazy bak

Re: RFC: #12815/#12816 -- TemplateResponse and render() shortcut

2010-12-01 Thread Łukasz Rekucki
On 1 December 2010 11:41, burc...@gmail.com wrote: > Hi Russell, > > On Wed, Dec 1, 2010 at 4:03 PM, Russell Keith-Magee > wrote: >> On Wed, Dec 1, 2010 at 3:55 PM, Mikhail Korobov >> wrote: >>> Just for the record: I'm with Ivan here and think that >>> >>> from django.template.response import

Re: RFC: #12815/#12816 -- TemplateResponse and render() shortcut

2010-12-01 Thread Ivan Sagalaev
On 12/01/2010 01:03 PM, Russell Keith-Magee wrote: I'd argue it doesn't simplify anything. It saves you a grand total of 10 characters (plus a couple more on import), but at the cost of the added complexity of having two ways of doing *exactly* the same thing. There is also a loss of explicitness

Re: RFC: #12815/#12816 -- TemplateResponse and render() shortcut

2010-12-01 Thread burc...@gmail.com
Hi Russell, On Wed, Dec 1, 2010 at 4:03 PM, Russell Keith-Magee wrote: > On Wed, Dec 1, 2010 at 3:55 PM, Mikhail Korobov > wrote: >> Just for the record: I'm with Ivan here and think that >> >> from django.template.response import TemplateResponse >> def my_view(request): >>    return TemplateR

Re: RFC: #12815/#12816 -- TemplateResponse and render() shortcut

2010-12-01 Thread Russell Keith-Magee
On Wed, Dec 1, 2010 at 3:55 PM, Mikhail Korobov wrote: > Just for the record: I'm with Ivan here and think that > > from django.template.response import TemplateResponse > def my_view(request): >    return TemplateResponse(request, 'foo.html') > > is worse than > > from django.shortcuts import ren

Re: RFC: #12815/#12816 -- TemplateResponse and render() shortcut

2010-11-30 Thread Mikhail Korobov
Just for the record: I'm with Ivan here and think that from django.template.response import TemplateResponse def my_view(request): return TemplateResponse(request, 'foo.html') is worse than from django.shortcuts import render def my_view(request): return render(request, 'foo.html') I th

Re: RFC: #12815/#12816 -- TemplateResponse and render() shortcut

2010-11-29 Thread Harro
I agree with Jacob on the bake/baked thing.. but maybe it's just CakePHP coming to haunt me :S On Nov 29, 1:09 pm, Ivan Sagalaev wrote: > On 11/29/2010 02:58 PM, Russell Keith-Magee wrote: > > > My counterargument would be this -- if you use TemplateResponse, > > there's no need to use a shortcu

Re: RFC: #12815/#12816 -- TemplateResponse and render() shortcut

2010-11-29 Thread Ivan Sagalaev
On 11/29/2010 02:58 PM, Russell Keith-Magee wrote: My counterargument would be this -- if you use TemplateResponse, there's no need to use a shortcut at all. Yes, this is what I understood from your reasoning. I'm concerned more with documentation. Namely, what are we going to suggest for usag

Re: RFC: #12815/#12816 -- TemplateResponse and render() shortcut

2010-11-29 Thread Russell Keith-Magee
On Mon, Nov 29, 2010 at 4:21 AM, Ivan Sagalaev wrote: > On 11/28/2010 10:13 AM, Russell Keith-Magee wrote: >> >> For your consideration, I present a patch to resolve #12815 and >> #12816, adding a TemplateResponse and a render() shortcut. > > Thank you! > >>  - The render() shortcut doesn't use Te

Re: RFC: #12815/#12816 -- TemplateResponse and render() shortcut

2010-11-29 Thread Russell Keith-Magee
On Sun, Nov 28, 2010 at 11:30 PM, Jacob Kaplan-Moss wrote: > Hi Russ -- > > On Sun, Nov 28, 2010 at 1:13 AM, Russell Keith-Magee > wrote: >> For your consideration, I present a patch to resolve #12815 and >> #12816, adding a TemplateResponse and a render() shortcut. > > Good stuff. > > A couple o

Re: RFC: #12815/#12816 -- TemplateResponse and render() shortcut

2010-11-28 Thread Ivan Sagalaev
On 11/28/2010 10:13 AM, Russell Keith-Magee wrote: For your consideration, I present a patch to resolve #12815 and #12816, adding a TemplateResponse and a render() shortcut. Thank you! - The render() shortcut doesn't use TemplateResponse. Since render() and TemplateReponse() have exactly th

Re: RFC: #12815/#12816 -- TemplateResponse and render() shortcut

2010-11-28 Thread sago
*very nice* Russ. Congrats and thanks! Totally removes a wart I've just got used to working around. "bake" is a pretty universal verb for this, afaict. I wouldn't say it was clever or new. "fry" however (in Jacob's post) was new to me and required googling. Ian. -- You received this message bec

Re: RFC: #12815/#12816 -- TemplateResponse and render() shortcut

2010-11-28 Thread Jacob Kaplan-Moss
Hi Russ -- On Sun, Nov 28, 2010 at 1:13 AM, Russell Keith-Magee wrote: > For your consideration, I present a patch to resolve #12815 and > #12816, adding a TemplateResponse and a render() shortcut. Good stuff. A couple of things though: * I'm really not a fan of "bake()" and ".baked" -- it rea