Closed Bug 605641 Opened 14 years ago Closed 14 years ago

Traceback: TemplateSyntaxError: expected token 'end of statement block', got '['

Categories

(addons.mozilla.org Graveyard :: Public Pages, defect)

defect
Not set
critical

Tracking

(Not tracked)

VERIFIED FIXED
5.12.2

People

(Reporter: stephend, Assigned: jbalogh)

References

()

Details

(Keywords: regression)

Loading https://preview.addons.mozilla.org/en-US/firefox/extensions/photos-music-videos/ gives:

Traceback (most recent call last):

  File "/data/amo_python/www/preview/zamboni/vendor/src/django/django/core/handlers/base.py", line 100, in get_response
    response = callback(request, *callback_args, **callback_kwargs)

  File "/data/amo_python/www/preview/zamboni/apps/browse/views.py", line 167, in extensions
    return category_landing(request, category)

  File "/data/amo_python/www/preview/zamboni/apps/browse/views.py", line 214, in category_landing
    'search_cat': search_cat})

  File "/data/amo_python/www/preview/zamboni/vendor/src/jingo/jingo/__init__.py", line 78, in render
    rendered = render_to_string(request, template, context)

  File "/data/amo_python/www/preview/zamboni/vendor/src/jingo/jingo/__init__.py", line 94, in render_to_string
    template = env.get_template(template)

  File "/data/amo_python/www/preview/zamboni/vendor/src/jingo/jingo/__init__.py", line 27, in get_template
    return super(Environment, self).get_template(name, parent, globals)

  File "/usr/lib/python2.6/site-packages/jinja2/environment.py", line 716, in get_template
    return self._load_template(name, self.make_globals(globals))

  File "/usr/lib/python2.6/site-packages/jinja2/environment.py", line 690, in _load_template
    template = self.loader.load(self, name, globals)

  File "/usr/lib/python2.6/site-packages/jinja2/loaders.py", line 127, in load
    code = environment.compile(source, name, filename)

  File "/usr/lib/python2.6/site-packages/jinja2/environment.py", line 492, in compile
    self.handle_exception(exc_info, source_hint=source)

  File "/data/amo_python/www/preview/zamboni/apps/browse/templates/browse/category_landing.html", line 31, in template
    {% for addon in addons|list|shuffle[:3] %}

TemplateSyntaxError: expected token 'end of statement block', got '['
Severity: major → critical
Keywords: regression
We upgraded Jinja (the template engine) yesterday in bug 603449.  This isn't a code error, it's something weird with the new jinja.

...but it looks like we can fix it by changing the code.  I think we're running into http://github.com/mitsuhiko/jinja2/issues#issue/2, so writing (addons|list|shuffle)[:3] should work.
http://github.com/jbalogh/zamboni/commit/4f4febd
Assignee: nobody → jbalogh
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.