Quantcast
Channel: Mako: Ticket Query
Viewing all articles
Browse latest Browse all 38

#215: warn/raise when a def/block is named "body"

$
0
0

Hi,

I was trying out mako and found a peculiar issue. If I have the name of a block as "body" the inheritance won't work. I am attaching the output of before and after ... this is a very simple example.

## layout.html <title> Hello </title> <%block name="body">Parent body </%block>

## show_entries.html

<%inherit file="layout.html" />

<%block name="body" > Body of show entries </%block>

## Code for rendering

templ = temp_lookup.get_template('show_entries.html') print templ.render()

## Output :

In [64]: print templ.render() Parent body

In [65]: print templ.render() Parent body

In [66]: templ = temp_lookup.get_template('show_entries.html')

In [67]: print templ.render() Parent body

## After changing the name="body" to name="body_2" in both

In [68]: templ = temp_lookup.get_template('show_entries.html') In [69]: print templ.render()

<title> Hello </title>

Body of show entries


Viewing all articles
Browse latest Browse all 38

Trending Articles