Google App Engine (python): TemplateSyntaxError: 'for' statements with five words should end in 'rev

Posted by Phil on Stack Overflow See other posts from Stack Overflow or by Phil
Published on 2010-04-01T20:16:15Z Indexed on 2010/04/02 12:33 UTC
Read the original article Hit count: 494

This is using the web app framework, not Django.

The following template code is giving me an TemplateSyntaxError: 'for' statements with five words should end in 'reversed' error when I try to render a dictionary. I don't understand what's causing this error. Could somebody shed some light on it for me?

{% for code, name in charts.items %}
   <option value="{{code}}">{{name}}</option>
{% endfor %}

I'm rendering it using the following:

class GenerateChart(basewebview):

    def get(self):
        values = {"datepicker":True}
        values["charts"] = {"p3": "3D Pie Chart", "p": "Segmented Pied Chart"}
        self.render_page("generatechart.html", values)

class basewebview(webapp.RequestHandler):
    ''' Base class for all webapp.RequestHandler type classes '''
    def render_page(self, filename, template_values=dict()):
        filename = "%s/%s" % (_template_dir, filename)
        path = os.path.join(os.path.dirname(__file__), filename)
        self.response.out.write(template.render(path, template_values))

© Stack Overflow or respective owner

Related posts about django

Related posts about python