Current way is good enough , it gives programmers choices. Many of us want to code in HTML as Long as they are static . May be pure python templating system which can be enable from response.view
On Wed, Aug 4, 2010 at 3:40 PM, mdipierro <mdipie...@cs.depaul.edu> wrote: > This is a good point. > > to do it with the current web2py the code at best would look like > this: > > > > Stef Mientki > View profile Translate to Translated (View Original) > More options Aug 4, 3:39 am > From: Stef Mientki <stef.mien...@gmail.com> > Date: Wed, 04 Aug 2010 10:39:48 +0200 > Local: Wed, Aug 4 2010 3:39 am > Subject: this must be asked a 1000 times, but I couldn't find the > answer > Reply | Reply to author | Forward | Print | Individual message | Show > original | Remove | Report this message | Find messages by this author > 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: > =BEAUTIFY ( response._vars ) > pass > > = 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' ) ) ), > '...') > }} > > I.e. > - extend, include, block and pieces of code must be between different > sets {{...}}. > - printed values must have the = prefix > - close blocks with pass > > Removing completely the {{...}} and "=" would require some changes in > the template system. > I guess it could be an option. > > > On Aug 4, 3: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> >