Dear Pocoo team,

I would like to get a list of all parent template paths for a template 
loaded from a file system that includes parent (inherited) templates. I am 
using the standard approach described in the documentation by preparing 
loaders and an environment to generate a template object, which I then use 
to render the final string. The source includes a "
find_referenced_templates" in the Meta submodule to do exactly what I'm 
seeking from an AST, but I could not find a way to generate an AST from an 
environment.Template object.

How would I go about getting a list of parent templates for a loaded 
template from the environment?

I've also posted this question on SO with a slightly more detailed 
explanation (
https://stackoverflow.com/questions/51157457/jinja2-reference-templates-for-a-template
). 

As a feature request, I suggest adding a 'parent_filenames' attribute to 
the environment.Template object to get a list of all parent template 
filenames. This would be a useful complementary to the 'filename' attribute 
of the template object. Alternative (or additionally), a 'get_ast' method 
in the environment.Template object would be helpful as well.

Thank you,

Justin

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

Reply via email to