As a general improvement (in terms of clarity) and as part of the
efforts of getting Chameleon working on GAE, I've begun reworking the
compilation stage.

If not explicitly disabled (using ``CHAMELEON_CACHE=0``), template
files (ending in .pt) will be compiled with the result written to a
Python-module with the same filename (ending in; Python will
of course attempt to write a byte-code compilation (ending in
.pt.pyc), which will guarantee good performance when restarting the


On template instantiation:

1) If the ``CHAMELEON_EAGER`` flag is enabled, parse template source
2) Load the template source module.
3) If the ``CHAMELEON_STATIC`` flag is enabled, compile into
one-method-fits-all-arguments render methods for main template and
each available macro (if required).

On render:

4) If the ``CHAMELEON_STATIC`` flag is enabled, collapse
keyword-arguments into dynamic context (econtext).

On compilation:

5) If the "render call signature" (keyword arguments and macro name)
matches an already compiled render-method, return it.


6) Compile template (to source string).
7) Append to template source module.
8) Reload template source module and return render-method.

Repoze-dev mailing list

Reply via email to