#1956 Backport the equalto test to ensure it works on old jinja2 version
Merged by pingou. Opened by pingou.
backport_old_jinja  into  master

Download 1956.patch

The equalto test was added in jinja2 version 2.8:
http://jinja.pocoo.org/docs/2.9/templates/#equalto
So to get it working on older version, we need this line added.

This fixes accessing an user's PR page such as:
https://pagure.io/user/pingou/requests

This has been hotfixed in prod

rebased

rebased

You might want to use an if statement so that this only happens if the version of jinja used doesn't have this. Something like:

if 'equalto' not in APP.jinja_env.tests:
    APP.jinja_env.tests['equalto'] = lambda value, other : value == other

Just one suggestion, LGTM either way.

Or APP.jinja_env.tests.setdefault('equalto', lambda value, other: value == other) if your into lesser-known dict methods ;).

I like this last one going with it :)

Thanks for the review!

rebased

Pull-Request has been merged by pingou

Metadata