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

VERIFIED FIXED in 5.12.2

Status

addons.mozilla.org Graveyard
Public Pages
--
critical
VERIFIED FIXED
7 years ago
2 years ago

People

(Reporter: stephend, Assigned: jbalogh)

Tracking

({regression})

unspecified
5.12.2
regression

Details

(URL)

(Reporter)

Description

7 years ago
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 '['
(Reporter)

Updated

7 years ago
Severity: major → critical
Keywords: regression
(Assignee)

Comment 1

7 years ago
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.
(Assignee)

Comment 2

7 years ago
http://github.com/jbalogh/zamboni/commit/4f4febd
Assignee: nobody → jbalogh
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → FIXED

Comment 3

7 years ago
No tracebacks on loading- 
https://preview.addons.mozilla.org/en-US/firefox/extensions/photos-music-videos/
https://preview.addons.mozilla.org/he/firefox/extensions/appearance/
https://preview.addons.mozilla.org/vi/firefox/extensions/download-management/
https://preview.addons.mozilla.org/ru/firefox/extensions/web-development/
https://preview.addons.mozilla.org/de/firefox/extensions/download-management/
https://preview.addons.mozilla.org/ja/firefox/extensions/web-development/
Status: RESOLVED → VERIFIED
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.