From 103bf4df1c0d85b7111cbeb0ab69d2fe2353b591 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Nov 15 2016 09:36:27 +0000 Subject: Move the encoding to the backend so it is done once for all the calls --- diff --git a/pagure/lib/__init__.py b/pagure/lib/__init__.py index 3ce0f09..136de74 100644 --- a/pagure/lib/__init__.py +++ b/pagure/lib/__init__.py @@ -2341,6 +2341,8 @@ def avatar_url_from_openid(openid, size=64, default='retro', dns=False): """ Our own implementation since fas doesn't support this nicely yet. """ + if isinstance(openid, unicode): + openid = openid.encode('utf-8') if dns: # pragma: no cover # This makes an extra DNS SRV query, which can slow down our webapps. diff --git a/pagure/ui/filters.py b/pagure/ui/filters.py index 0600f81..b05b17d 100644 --- a/pagure/ui/filters.py +++ b/pagure/ui/filters.py @@ -275,8 +275,6 @@ def avatar_url(email, size=64): """ Template filter sorting the given branches, Fedora first then EPEL, then whatever is left. """ - if isinstance(email, unicode): - email = email.encode('utf-8') return pagure.lib.avatar_url_from_openid(email, size)