Ah right, you can't have includes inside of blocks ! This is not a bug, just
a side-effect of how includes are implemented vs blocks.
I know understand the reasoning behind the str(t.content) patch, which was a
workaround to getting includes to work inside of blocks, but not the proper
solution.
It only worked because of the str(t.content) workaround, otherwise you were
not able to have includes inside blocks from the beginning.
--
Thadeus
On Tue, May 31, 2011 at 1:59 PM, teemu teemu.kuulas...@gmail.com wrote:
Hi
I tried to figure out this problem more carefully and I found the
reason why my app didn't work anymore:
If the parent block contains {{include 'some_file'}} and view tries to
extend it by calling {{super}}, whole parent block will be ignored!!!
I don't see any error messages etc. This behavior has been changed
after version 1.94.6. The same code works in 1.94.6 but not in
1.95.1. Unfortunately I do not know web2py internals enough to figure
out what has been changed since!
Simplified test case:
controller function (default.py):
--
def test():
return dict();
--
view (test.html):
-
{{extend 'layout.html'}}
{{block content}}
this text will be shown in web page correctly
{{super}}
{{end content}}
--
view (layout.html): (stripped down, only relevant block is shown)
-
.
{{block content}}
this text wont be seen in web page if this block is
extended by calling super!
{{include 'test.txt'}}
{{end content}}
.
-
dummy text file (test.txt)
-
some irrelevant text to be included into view
-
If I remove {{include 'text.txt'}} from layout.html everything works
perfectly (text/code from the parent block will be included in
extended block). Web2py doesn't allow include directives in parent
blocks anymore!!
Teemu