You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
emit warning when a block or def is named "body" #263
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 '
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.
Activity
sqlalchemy-bot commentedon May 19, 2017
Changes by Bérenger Enselme (@benselme):
sqlalchemy-bot commentedon May 19, 2017
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 commentedon May 19, 2017
Changes by Michael Bayer (@zzzeek):
sqlalchemy-bot commentedon May 19, 2017
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.