Everyone at some point has this thought. But there is a big down side
to generating all the html in code, it makes the application hard to
skin. I can skin a web2py application in half and hour not including
cleaning up the menus with any template I come across. I do like
generate the html I am grabbing from the data most the time. Nice to
have both methods available.

On Aug 4, 1:39 am, Stef Mientki <stef.mien...@gmail.com> wrote:
>  please forgive my ignorance,
> but I wonder why views are not written in Python, instead of html ( see 
> comparison below of te first
> part of default\index.html.
>
> The advantage of using Python:
> - the user can stick to 1 language
> - no redundant information in the closing tags, like <ul> , </ul>
> - most editors checks the closing brackets
> - normal indentation, no problems with missing "pass"
> The disavantages of using Python:
> - ???
>
> thanks,
> Stef Mientki
>
> # ***************************************************************
> extend ( 'layout.html' )
>
> if 'message' in globals () :
>   H2 ( message )
> else:
>   DISPLAY ( BEAUTIFY ( response._vars ) )
>
> HR ()
> H1 ( 'README' )
> UL (
>   LI ( T ( 'You are successfully running web2py' ) ),
>   LI ( T ( 'This is a copy of the scaffolding application' ) ),
>   LI ( T ( 'You can modify this application and adapt it to your needs' ) ),
>   LI ( T ( A ( B ( T ( "click here for the administrative interface")),
>               _HREF ( URL ( 'admin', 'default', 'index' ) ) ) ) ),
>   LI ( A ( T ( "click here for online examples"),
>            _HREF ( URL ( 'examples', 'default', 'index' ) ) ) ),
>   LI ( HREF ( "http://web2py.com";, 'web2py.com' ) ),
>   LI ( HREF ( "http://web2py.com/book";, T ( 'documentation' ) ) ) )
>
> # ***************************************************************
> {{extend 'layout.html'}}
>
> {{if 'message' in 
> globals():}}{{=H2(message)}}{{else:}}{{=BEAUTIFY(response._vars)}}{{pass}}
>
> <hr />
> <h1>README</h1>
> <ul>
>   <li>{{=T('You are successfully running web2py')}}</li>
>   <li>{{=T('This is a copy of the scaffolding application')}}</li>
>   <li>{{=T('You can modify this application and adapt it to your 
> needs')}}</li>
>   <li>{{=A(B(T("click here for the administrative interface")),
> _href=URL('admin','default','index'))}}</li>
>   <li>{{=A(T("click here for online examples"), 
> _href=URL('examples','default','index'))}}</li>
>   <li><a href="http://web2py.com";>web2py.com</a></li>
>   <li><a href="http://web2py.com/book";>{{=T('documentation')}}</a></li>
> </ul>

Reply via email to