relative paths for (include/extends) in jinja2 templates
This commit is contained in:
parent
c8854a23ea
commit
4a6b5c5de2
2 changed files with 5 additions and 1 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -14,3 +14,6 @@ rpm-build
|
|||
.idea
|
||||
# Mac OS X stuff
|
||||
.DS_Store
|
||||
# Sublime stuff
|
||||
*.sublime-project
|
||||
*.sublime-workspace
|
||||
|
|
|
@ -392,7 +392,8 @@ def template_from_file(basedir, path, vars):
|
|||
''' run a file through the templating engine '''
|
||||
|
||||
realpath = path_dwim(basedir, path)
|
||||
environment = jinja2.Environment(loader=jinja2.FileSystemLoader(basedir), trim_blocks=True)
|
||||
loader=jinja2.FileSystemLoader([basedir,os.path.dirname(realpath)])
|
||||
environment = jinja2.Environment(loader=loader, trim_blocks=True)
|
||||
environment.filters['to_json'] = json.dumps
|
||||
environment.filters['from_json'] = json.loads
|
||||
environment.filters['to_yaml'] = yaml.dump
|
||||
|
|
Loading…
Reference in a new issue