﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
13608	Clarify failure of lookups when argument to lookup is not an int	anonymous	Derek Willis	"The docs for templating api say the following:

{{{

Dots have a special meaning in template rendering. A dot in a variable name signifies lookup. Specifically, when the template system encounters a dot in a variable name, it tries the following lookups, in this order:

    * Dictionary lookup. Example: foo[""bar""]
    * Attribute lookup. Example: foo.bar
    * Method call. Example: foo.bar()
    * List-index lookup. Example: foo[bar]

}}}

From this, I was under the impression that the following would work...

View...
{{{
context = dict(sizes=['SM', 'MD', LG'], available= {'SM': True, 'MD' : False, 'LG' : False})
return render_to_response('index.html', context)
}}}

Template...
{{{
{% for size in sizes %}
   {% if apparel.size %}
       {{size}} is available!
   {% else %}
       {{size}} is not available!
   {% endif %}
{% endfor %}
}}}

I had to look into the code to discover that when the docs mean list-lookup foo[bar], that if bar is a string, it will not do a dictionary lookup. Clarifying that the list lookup will only work with integers would be helpful."	Cleanup/optimization	closed	Documentation	dev	Normal	fixed			Accepted	1	0	0	0	0	0
