[Grok-dev] Re: first thoughts on "regebro-guido-templates"
Martijn Faassen
faassen at startifact.com
Tue Oct 30 05:31:25 EDT 2007
Lennart Regebro wrote:
> On 10/29/07, Martijn Faassen <faassen at startifact.com> wrote:
>> Actually this is somewhat attractive for inline templates for another
>> reason - inline templates tend to grow a larger and larger list of
>> arguments
>
> Oh?
Or that was my impression. I've noticed several times in the past that
we somehow felt the need to add another parameter to inline template
instantation. Then again, I forget what. :)
>> I'm not sure I understand this approach.
>>
>> As far as I know, this wouldn't stop instances being imported from
>> another module being grokked as well.
>
> Sure, but is that a problem? We can make sure we only Grok them once,
> and then this would only be a problem if they are imported from a
> module that is not being grokked.
It might not be a huge problem, but that doesn't seem very pretty to me
either.
[snip]
>> This sounds attractive! Just one class would definitely be better than
>> having to do two. How to go about collapsing this? Lennart, does this
>> look doable?
>
> Sure.
Excellent!
>> In order to get this merged, I'd suggest we prioritize as follows:
>>
>> * single-class approach - would be nice to do this before merge if this
>> is doable with a moderate amount of work. This would make the extension
>> story that much cleaner and clearer.
>
> OK, I'll try to get that done this week at least.
Hopefully Brandon will come up with a few more of his thoughts about
this too.
[snip]
> I would like the template namespace() to be
> responsible for both creating the default namespace, and updating it
> with view.namespace().
>
> It's just a matter of moving the namespace.update(view.namespace())
> from one method in the template to another, and hence no big
> improvement in many cases, but I find it clearer, since the render
> method gets much cleaner:
>
> def render(self, view):
> return self._template.render(self.namespace())
>
> Basically, it goes from three lines to one, while the namespace method
> goes from 6 to 7. It's silly to count lines, but... yeah, it just
> feels...cleaner. :-)
Okay, at first sight I can't see any drawbacks to this, so fine with me. :)
Regards,
Martijn
More information about the Grok-dev
mailing list