On Sun, Aug 17, 2008 at 11:44 PM, Vonbo <[EMAIL PROTECTED]> wrote:
>
> hi all ^_^:
> our team is preparing to use jinja2 instead of django template
> system in a new project, when I move some old template code to
> jinja2(the latest released version 2.0) , I found this :
> The dict at python file just like this:
> d = {'name' : ['myname', True]}
> In the template file(old version which uses django template), we
> use:
> {% for item in d.items %}
> {{ item.0 }} -> {{ item.1.0 }}
> which we expect its output is : name->myname
>
> In jinja2 , we change out template to :
> {% for item in d.items() %}
> {{ item.0 }} -> {{ item.1.0 }}
>
Sorry I can't answer your question - not being a pocoo developer - but
I think the readability aspects of your example demonstrates why jinja
templates are nice. Why not the following?
{% for (key, values) in d.items() %}
{{ key }} -> {{ values[0] }}
{% endfor %}
--
\\\\\/\"/\\\\\\\\\\\
\\\\/ // //\/\\\\\\\
\\\/ \\// /\ \/\\\\
\\/ /\/ / /\/ /\ \\\
\/ / /\/ /\ /\\\ \\
/ /\\\ /\\\ \\\\\/\
\/\\\\\/\\\\\/\\\\\\
d.p.s
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pocoo-libs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pocoo-libs?hl=en
-~----------~----~----~----~------~----~------~--~---