[Grok-dev] Grok 1.0 final?

Martin Aspeli optilude+lists at gmail.com
Wed Apr 15 10:38:01 EDT 2009


Martijn Faassen wrote:
> Martin Aspeli wrote:
>> Wichert Akkerman wrote:
>>
>>> templates/<context id>_<view id>
>> +1
>>
>>> .html
>> -1
>>
>>> where context id probably defaults to the __name__ of the view context,
>>> and view id to the name of the view.
>> +1
>>
>>> I prefer to use html as extension
>>> for attribute based template languages (genshi, tal, kid, etc.) so tools
>>> such as html editors and browsers know how to handle the file.
>> -1 -- The filename should indicate how the file will be treated. .html 
>> means "this is a static html file", whereas ".pt" says "this is TAL".
> 
> I'd like to explore this further, as I think many people would like this 
> design (as +1 and -1-ed by Martin). I'd like to see a grok extension 
> (probably a different grok view base class) that supports this pattern. 
> We can then consider this for adoption in the core at some point.
> 
> Issues to explore are naming views that have an interface as context, 
> and I'm sure a lot more.

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.

> Note that Grok's template language pluggability also relies on 
> extensions. If you want to use a different templating language for a 
> view, you just use a different extension. If you were to use .html for 
> everything you'd probably need to indicate in the view what template 
> language you're using, or indicate it globally. I'd not mind if the 
> extension had optional support for this, but the main use case should be 
> one extension per template language in my opinion.

+1

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