No problem be as criticl as you wish.
Please do not take my critique in a bad way, but be very careful when
adding blocks of code in your views, I understand the example above
is just a code sample to illustrate a perceived deficiency in the
view templating system, but unless you are a PHP
Actually I began by using functions too. But had some problems (can't
remember exactly what), and view functions, even if comprised exclusively of
view code didn't really tick my fancy. I much rather extract those snippets
of HTML to a module or model file exclusively dedicated to html snippets.
Good point, was just going to post this myself, you beat me to it. A hint
should be added to the web2py book in chapter 5
http://web2py.com/book/default/chapter/05?search=block#Blocks-in-Views
something
like:
The *{{block}} {{end}}* construction *cannot be used* inside a python
condition
I missed that comments feature. Great you added one!
Miguel
On Tue, Jul 19, 2011 at 12:48 PM, Nico de Groot ndegr...@chello.nl wrote:
Good point, was just going to post this myself, you beat me to it. A hint
should be added to the web2py book in chapter 5
On Jul 13, 3:42 am, Miguel Lopes mig.e.lo...@gmail.com wrote:
I think this behavior I've just found is worth sharing.
Templates don't honor the if statement that conditionally try to include
or exclude template blocks.
I've just detected this (in 1.96.4 I think) and upgrade to 1.97.1 and the
I prefer to work in the old way, used when web2py had no block in views. It
is very easy and pure Python code.
{{def myblock():}}
html code/html code
{{return}}
So, in any place of views...
{{=myblock()}}
Obviouslly in this way you cannot have {{super}} and other cool things, but
it is easy
6 matches
Mail list logo