Re: can anyone help me in developing a simple webpage in jinja2
Satabdi Mukherjee wrote: > i am a rookie in python and i am trying > to develop a simple webpage using jinja2. > > can anyone please help me how to do that You might try using your jinja template with named tuples # --- from jinja2 import Template from collections import namedtuple as NT nt = NT( 'Navigation' , 'href caption' ) n1 = nt( 'http://python.org' , 'python' ) n2 = nt( 'http://cython.org' , 'cython' ) n3 = nt( 'http://jython.org' , 'jython' ) n4 = nt( 'http://pypy.org/' , 'pypy' ) nav = ( n1 , n2 , n3 , n4 ) tmpl = Template( '''\ My Webpage {% for url , caption in navigation %} {{ caption }} {% endfor %} My Webpage {{ a_variable }} ''' ) print tmpl.render( variable = 'Navigation' , navigation = nav ) -- Stanley C. Kitching Human Being Phoenix, Arizona -- http://mail.python.org/mailman/listinfo/python-list
Re: can anyone help me in developing a simple webpage in jinja2
On Sat, Apr 6, 2013 at 6:15 PM, Jan Riechers wrote: > The invalid syntax is raised when? Can you post the error a bit more > detailed, this will help giving you any advice. > > If you know the code part raising the error and you post it, this will also > help. Agreed. But my guess would be the lack of colon on the for loop... which would be highlighted by the error thrown. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: can anyone help me in developing a simple webpage in jinja2
On 06.04.2013 01:41, Satabdi Mukherjee wrote: i am a rookie in python and i am trying to develop a simple webpage using jinja2. can anyone please help me how to do that i am trying in this way but showing invalid syntax error [...] {% for item in navigation %} {{ item.caption }} {% endfor %} My Webpage {{ a_variable }} [...] Hello, the jinja2 syntax is correct that way, see also this for reference for variable naming: http://jinja.pocoo.org/docs/templates/index.html#variables The invalid syntax is raised when? Can you post the error a bit more detailed, this will help giving you any advice. If you know the code part raising the error and you post it, this will also help. Jan -- http://mail.python.org/mailman/listinfo/python-list
can anyone help me in developing a simple webpage in jinja2
i am a rookie in python and i am trying to develop a simple webpage using jinja2. can anyone please help me how to do that i am trying in this way but showing invalid syntax error My Webpage {% for item in navigation %} {{ item.caption }} {% endfor %} My Webpage {{ a_variable }} -- http://mail.python.org/mailman/listinfo/python-list