Discussion:
How to list the XInclude template chain?
Leho Kraav
2014-09-14 10:12:40 UTC
Permalink
I am interested in knowing which Genshi templates / parts have been
processed during the application request. How do I find out who included
what where, in what order?
--
You received this message because you are subscribed to the Google Groups "Genshi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to genshi+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/genshi.
For more options, visit https://groups.google.com/d/optout.
Simon Cross
2014-09-20 09:47:16 UTC
Permalink
Hi Leho

This is a good question (and so is not easily answered :).

Genshi's template including is fairly complicated. Sub-templates can
either be inlined during template compilation (loading) or dynamically
included during generation.

Inlined sub-templates can't be detected after a template is loaded
(because they've already been included).

Dynamically included templates appear as INCLUDE elements in the
template stream, so one could look for those (although that would only
give one a single level of includes).

One trick you can use is to include a tracker object (e.g. a dict,
list or fancy helper object) in your template context and then have
each template record important events in the tracker object. This
isn't ideal for automated tracking, but on the up side one can track
all sorts of meaningful things.

Schiavo
Simon
--
You received this message because you are subscribed to the Google Groups "Genshi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to genshi+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/genshi.
For more options, visit https://groups.google.com/d/optout.
Loading...