[Grok-dev] megrok.chameleon template engine

Uli Fouquet uli at gnufix.de
Tue Feb 24 09:28:57 EST 2009


Hi Sebastian,

Sebastian Ware wrote:
> Did I understand it correctly that Chameleon only supports TALES  
> python expressions?

`chameleon.zpt` supports TALES python expressions _by default_. Here is
the whole picture:

As far as I can see (could not find complete documentation for all
use-cases) it supports TALES Python expressions,::

  <div tal:content="view.myval">MyVal</div>

TALES string expressions::

  <div tal:content="string:Hello" />

and TALES structure expressions::

  <div tal:content="structure: view.myval" />

TALES path expressions are _not_ supported currently as far as I can
see. This also applies to TALES ``exists:`` expressions.

For me it is much more convenient to write a Python expression than a
path expression so I do not miss it very much. It was indeed the main
reason for me to write this extension: getting rid of "python:...".

Furthermore you can use the usual suspects like

* tal:define
* tal:attributes
* tal:content
* tal:replace
* tal:condition
* tal:omit-tag
* metal:define-slot
* metal:fill-slot

and, additionally, Genshi-like interpolation inside and outside tags::

  <div name="${view.myval}">
    ${view.myval}
  </div>

which is also very convenient IMHO.

A `megrok.chameleon` specific drawback is, that template changes are not
reloaded automatically on changes. This could be changed but might mean
a remarkable performance decrease.

Hope that helps,

-- 
Uli

-------------- 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/20090224/a4c2a8c5/attachment-0001.bin 


More information about the Grok-dev mailing list