raphi...@gmail.com wrote:

> Note that in my example the content to be inserted is not the result 
of a
> variable substitution, but the result of a call to a function. format
> doesn't seem to work in this case. And jinja2 doesn't seem to provide 
a
> straight forward solution either
> 
> Thx

Yoy may try it, setup an environment (dictionnary) with 'time' mapped 
to the time module, and render the template using this environment. 
Normally Jinja2 manage namespaces and function call.

Your template would be:

    filename: /tmp/backup_{{ time.strftime('%Y-%m-%d') }}.tgz

And the environment for rendering simply:

import time
env = { time: time }

http://jinja.pocoo.org/docs/templates/#other-operators




-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to