Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macro doesn't work in async mode if autoescape is enabled #671

mohd-akram opened this issue Jan 24, 2017 · 0 comments


Copy link

commented Jan 24, 2017

Expected Behavior

The macro call should render correctly.

Actual Behavior

The macro call is rendered as a coroutine object repr (<coroutine object macro at 0x10ce50728>).

Python Code

import asyncio

from jinja2 import Template

loop = asyncio.get_event_loop()

async def main():
    print(await render())

async def render():
    t = Template('{% macro foo(x) %}{{ x }}{% endmacro %}{{ foo(42) }}',
                 enable_async=True, autoescape=True)
    return await t.render_async()


Full Traceback

/Users/mohamed/.virtualenvs/ RuntimeWarning: coroutine 'macro' was never awaited
  rv = Markup(rv)

Your Environment

  • Python version: 3.6
  • Jinja version: 2.9.4

mitsuhiko added a commit that referenced this issue Jan 28, 2017

@mitsuhiko mitsuhiko closed this in d7d64cb Jan 28, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
1 participant
You can’t perform that action at this time.