2009/5/4 Carlos de la Guardia <carlos.delaguar...@gmail.com>:
> If Malthe or anyone else has a good idea about how to do this and will give
> me some pointers, I'm willing to use my limited abilities to make this work.
> Otherwise, I might try to bring in old zpt.

It can be done, but it requires the introduction of a new compilation
mode, which will essentially produce a source-file which will "fit
all"; currently, the compiler produces one source-file per
keyword-argument signature. That's obviously not something you can
reasonably determine at compile-time.

The way to go about this is probably to have the render-method do
something like this:

def render(**kwargs):
   return render_template(econtext=kwargs['econtext'])

Such that all variables will be pulled from the dynamic variable
scope; this should work, but otoh, there's always some trickery with
that 'econtext'.

Chameleon has a mode of operation triggered by the CHAMELEON_EAGER
flag; this basically parses all templates at initialization; I think
we can hijack this mode to force the above-mentioned "fallback"
compilation. The render-logic would then be something like this:

1) Do we have ``ast`` and ``compiler`` available?
2) If not, is a fallback source-file available?

Repoze-dev mailing list

Reply via email to