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

emit warning when a block or def is named "body" #263

Open
sqlalchemy-bot opened this issue May 19, 2017 · 4 comments
Open

emit warning when a block or def is named "body" #263

sqlalchemy-bot opened this issue May 19, 2017 · 4 comments
Labels
bug Something isn't working

Comments

@sqlalchemy-bot
Copy link

Migrated issue, originally created by Bérenger Enselme (@benselme)

This is using CPython 3.6.1

from mako.template import Template

if __name__ == '__main__':
    s = Template("""aaaa<%block name="bodi"></%block>bbbb""").render()
    assert s == 'aaaabbbb'  # success
    s = Template("""aaaa<%block name="body"></%block>bbbb""").render()
    assert s == 'aaaabbbb'  # failure, s == '\n '
@sqlalchemy-bot
Copy link
Author

Changes by Bérenger Enselme (@benselme):

  • edited description

@sqlalchemy-bot
Copy link
Author

Michael Bayer (@zzzeek) wrote:

this is expected behavior. "body" is a pre-existing name with special behavior and is documented here. It is possible people use it as a "block" name intentionally.

@sqlalchemy-bot
Copy link
Author

Changes by Michael Bayer (@zzzeek):

  • changed title from "Blank output when there is a block named "body"" to "emit warning when a block or def is named "body""

@sqlalchemy-bot
Copy link
Author

Bérenger Enselme (@benselme) wrote:

Thanks, I get it now. I was aware of the body() function but it was not obvious at all that naming a block "body" would overwrite it.

@sqlalchemy-bot sqlalchemy-bot added the bug Something isn't working label Nov 26, 2018
@bourke bourke added this to Backlog in Mako prioritization Nov 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

1 participant