This is a grok facility. When you create a view class descended from
grok.View, the template is automatically sought in a content_type_templates/
view.pt file where "view" is the all lower-case version of the view class
name. If there were several view classes for a content type, there would be
several templates in the content_type_templates folder.

Remember, with grok, there's no zcml wiring and no code specification of the
template location, so the template file needs to be sought by convention.

Whether you think of this as "magic" or "convention" depends on which side
of the looking glass you're on. I think it just takes some getting used to.

On Tue, Jun 7, 2011 at 2:15 AM, Mikko Ohtamaa <mi...@redinnovation.com>wrote:

> .
> >
> > I suppose this was done to make the new layout more grok-like, with a bit
> of
> > convention over configuration: models/content types in mymodel.py are
> > associated automagically with templates in the mymodel_templates
> directory,
> > unless explicitly specified differently.
>
> Wouldn't it make more sense have all templates under one director and
> create one template per model in this directory?
>
> I know it's bad to start guessing use cases, but usually you need one
> view template per content type, or view and edit template. Creating
> one folder and then one file in this folder just for this seems to be
> little overkill.
>
> >
> > Both approaches are fine with me; I think I can get used to the new
> layout.
> >
>
_______________________________________________
ZopeSkel mailing list
zopes...@lists.plone.org
https://lists.plone.org/mailman/listinfo/plone-zopeskel

Reply via email to