Re: Template.render() should accept a dictionary, not just a Context object

2008-04-11 Thread Marty Alchin
On Fri, Apr 11, 2008 at 12:02 PM, Patryk Zawadzki <[EMAIL PROTECTED]> wrote: > Why not use the opposite test and check for instances of dict? Because then you have to pass something that subclasses dict instead of something that implements the interface of dict. We could go on and on about this

Re: Template.render() should accept a dictionary, not just a Context object

2008-04-11 Thread Patryk Zawadzki
On Fri, Apr 11, 2008 at 5:49 PM, Rajeev J Sebastian <[EMAIL PROTECTED]> wrote: > On Fri, Apr 11, 2008 at 8:56 PM, Simon Willison <[EMAIL PROTECTED]> wrote: > > > > def render(self, context): > > "Display stage -- can be called many times" > > if not isinstance(context, Context): >

Re: Template.render() should accept a dictionary, not just a Context object

2008-04-11 Thread Rajeev J Sebastian
On Fri, Apr 11, 2008 at 8:56 PM, Simon Willison <[EMAIL PROTECTED]> wrote: > > def render(self, context): > "Display stage -- can be called many times" > if not isinstance(context, Context): > context = Context(context) > return self.nodelist.render(context) > > This is

Template.render() should accept a dictionary, not just a Context object

2008-04-11 Thread Simon Willison
Here's something that has been quietly bugging me about Django for / years/: Context() is an implementation detail of the template engine. Having to instantiate a Context just to pass it to render() is unnecessary boilerplate (and means you have to import another symbol as well).