How to list the XInclude template chain?

15 views
Skip to first unread message

Leho Kraav

unread,
Sep 14, 2014, 6:12:40 AM9/14/14
to gen...@googlegroups.com
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?

Simon Cross

unread,
Sep 20, 2014, 5:47:18 AM9/20/14
to gen...@googlegroups.com
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
Reply all
Reply to author
Forward
0 new messages