Closed alessandrothea closed 3 years ago
Thanks for this, @alessandrothea ! I reproduce this with moo imports
.
The problem is due to me mistakenly thinking Jinja returned an already resolved path from find_referenced_templates()
.
I'll commit a fix next. Instead of asking moo to resolve()
, it relies on Jinja to do the resolution. In this way we can assure the import would also be resolved when later used in a render
.
A few other bug fixes have piled up so I'll make a new release to include them and this fix.
Awesome, thanks!
Just to give you the heads up, I will probably ask for a new tag, once you're happy with the fix! ;-)
As promised :)
Thanks!
Hi @brettviren ,
While playing with custom templates earlier today I stumbled on an issue when trying to include a macro file in a jinja template.
I have 2 jinja files, a template (
OpMonStructs.hpp.j2
) and a macro file (opmon_hpp_macros.j2
)OpMonStructs.hpp.j2
includesopmon_hpp_macros.j2
as a jinjia import:but Jinja fails to resolve
opmonlib/opmon_hpp_macros.j2
even ifschema
is in themoo
template path. After a quick look into the code I think the issue might be thatmoo.utils.imports
doesn't pass the template paths to theresolve
function. After patching my local copy as followsthe issues of jinjia not finding
opmonlib/opmon_hpp_macros.j2
seem gone and the template is correctly instantiated. Would you mind having a look? Thanks!Alessandro