[Zope] Re: page templates and "python:"
Tres Seaver
tseaver at palladion.com
Mon Jul 3 11:48:53 EDT 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Lennart Regebro wrote:
> On 7/3/06, Chris McDonough
> <chrism at plope.com> wrote:
>> Actually, I think python: expressions perform slightly better than
>> their path: counterparts because their evaluation step needs to do
>> less work (no guessing about getitem vs. getattr). Geoff Davis
>> taught me that. But in the end it's all dwarfed by the penalty
>> imposed by security, so it really doesn't much matter.
>
> Right. So the best and quickest is to prepare all the data in pure
> disk-based python.
> It's easy to do if you use the view methodology you get with Five, but
> there are other ways to do it if you don't want to use views.
My 'pushpage' package is an attempt to make this the "standard" pattern
(pushpage templates don't have *any* top-level names available to them
(i.e., 'context', 'container', 'request', etc.) except those passed to
their '__call__' as keyword arguments (which traditional ZPT exposes
under 'options'):
http://agendaless.com/Members/tseaver/software/pushpage
The templates can be used from within methods of view classes, and can
also be published as "pages" via ZCML with the help of a user-defined
callable which computes the keyword arguments. E.g.:
<pushpage:view
for=".interfaces.ISomeContentInterface"
name="somepage.html"
permission="zope.Public"
template="templates/sometemplate.pt"
mapping=".somemodule,somefunction"
layer="mylayer"
/>
In this example, 'somemodule.somefunction' returns the mapping which
'sometemplate' will use as its top-level namespace. The callable is
passed 'context' and 'request' as arguments.
Tres.
- --
===================================================================
Tres Seaver +1 202-558-7113 tseaver at palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFEqTxk+gerLs4ltQ4RArSWAJ90L7NT76aPuaIk9a7cQj222qYM6QCfRPrZ
gN4Q7fIm63hA4HUoViIwdBk=
=2aTX
-----END PGP SIGNATURE-----
More information about the Zope
mailing list