Making a pass form cgi => webpy framework

rusi rustompmody at gmail.com
Mon Jun 24 11:51:30 EDT 2013


On Monday, June 24, 2013 1:02:51 PM UTC+5:30, Νίκος wrote:

> And also in my pelatologio.py and other script i use if statements to 
> check if user submitted data or not so to print them on screen and then 
> exit, like modularization.
> 
> 
> 
> foe example:
> 
> if( log ):
> 	name = log
> 	print this and this
> 
> if( seek ):
> 	other statements
> 	print this and this
> 
> 
> How will i be able to do this if i use an html template
> every time an if() runs all the html will run and not a part of it.

Every significant templating system has something for this
eg in mako
http://docs.makotemplates.org/en/latest/syntax.html#control-structures

The main thing to understand is this:
- When you use straight python, by default you are 'inside python' except when inside strings (inside prints) then you are 'inside html'

- When using a templating engine, by default you are inside html, except when you escape from html into python



More information about the Python-list mailing list