[Grok-dev] Grok 1.0 final?

Martin Aspeli optilude+lists at gmail.com
Wed Apr 15 11:11:14 EDT 2009


Martijn Faassen wrote:
> Martin Aspeli wrote:
>> Martijn Faassen wrote:
>>> Hey,
>>>
>>> Martin Aspeli wrote:
>>> [snip]
>>>> Actually, I wouldn't name it after the context, I'd name it after the 
>>>> module + class name. The idea is that in my source code browser, I see 
>>>> mytype.py and templates/mytype_view.pt. It's obvious that this matches 
>>>> mytype.py:View. If I had an Edit view in mytype.py, I'd see 
>>>> templates/mytype_edit.pt and so on.
>>> Good point, that's much simpler, view module name + view class name.
>> Can I also ask: I'm fairly confused by the whole 
>> default_namespace/namespace dance. Is there an actual use case for that?
> 
> Ah, in template pluggability? The idea is that the default_namespace() 
> function is defined by the base template implementation. Viewlets offer 
> a different implementation that pushes the `viewletmanager`` and 
> ``viewlet`` objects into the template.

Oh right. That was a fun one, by the way. In regular viewlets, the 
viewlet is accessible as 'view' (confusing, perhaps) in the template, 
but in a grok view you use 'viewlet' (better, perhaps).

> namespace() is if a particular template wants to control what enters the 
> namespace of the template.
 >
> I think it's quite possible we could improve this code by some judicious 
> refactoring, but I do think there are use cases for control of template 
> namespaces.

Really? It smells a bit like YAGNI to me when we have update() and you 
can just set variables on the view.

Martin

-- 
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book



More information about the Grok-dev mailing list