In async mode, if I create a custom async filter, it works correctly when called on data passed by render, but not on constants in the template itself. See code below.
Expected Behavior
print
Actual Behavior
print
<coroutine object myfilter at 0x7f89c7a393c0>
Hello test2
Template Code
import asyncio
import jinja2
async def myfilter(instr):
return f'Hello {instr}'
async def main():
env = jinja2.Environment(enable_async=True)
env.filters['myfilter'] = myfilter
tmpl = env.from_string('{{"test1"|myfilter}}\n{{x|myfilter}}')
text = await tmpl.render_async(x='test2')
print(text)
if __name__ == '__main__':
asyncio.run(main())
Your Environment
- Python version: 3.8.2
- Jinja version: 2.11.2
In async mode, if I create a custom async filter, it works correctly when called on data passed by
render, but not on constants in the template itself. See code below.Expected Behavior
print
Actual Behavior
print
Template Code
Your Environment