[Grok-dev] Acquiring macros
Christian Theune
ct at gocept.com
Thu Apr 26 01:47:43 EDT 2007
Hi,
this is partially a generic Zope 3 thingy, but as we've been talking
about skins and layers anyway ...
I wondered that the problem of defining and accessing standard layout
elements (e.g. macros in PT) didn't show up in the discussion yet. I
skimmed through the last weeks of discussions but didn't see anything.
The existing pattern in Zope 3 is to define a view derived from the
StandardMacros class that provides aliasing and tries to look up a macro
from an existing view a bit disturbing from the point that you have to
register your templates as views and also make them available for all
objects. This sounds weird.
Observings:
- In CMF templates are templates.
- In Zope 3 a template is turned into a view before accessing a macro.
- In CMF templates live in various folders that can be customized easily
by providing other folders with a higher priority, shadowing away the
name lookup.
- In Zope 3, as templates are views, the customization can happen using
a derived layer that overrides the names.
- The declaration of aliasing and which templates to assemble into the
standard macro lookup is weird. However, you can totally omit this
indirection if you do not like it. Just use here/@@myview/macro
directly. (I thought this doesn't work, but it does.)
- In Zope 3 and in CMF templates are accessible everywhere.
I think I like our (Zope 3's) situation better in all cases except the
last. One of the major achievements over views in CMF for me is that I
can lock down views to objects where they make sense *and* avoid
accessing partial templates from just anywhere.
I wonder whether we can do better.
Christian
--
gocept gmbh & co. kg - forsterstraße 29 - 06112 halle/saale - germany
www.gocept.com - ct at gocept.com - phone +49 345 122 9889 7 -
fax +49 345 122 9889 1 - zope and plone consulting and development
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://mail.zope.org/pipermail/grok-dev/attachments/20070426/f2f62ebf/attachment.bin
More information about the Grok-dev
mailing list