aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rhodecode/lib/helpers.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/rhodecode/lib/helpers.py b/rhodecode/lib/helpers.py
index 2183ae69..2f073611 100644
--- a/rhodecode/lib/helpers.py
+++ b/rhodecode/lib/helpers.py
@@ -750,14 +750,14 @@ HasRepoPermissionAny, HasRepoPermissionAll
def gravatar_url(email_address, size=30):
from pylons import url # doh, we need to re-import url to mock it later
-
- if (not str2bool(config['app_conf'].get('use_gravatar')) or
- not email_address or email_address == 'anonymous@rhodecode.org'):
+ _def = 'anonymous@rhodecode.org'
+ use_gravatar = str2bool(config['app_conf'].get('use_gravatar'))
+ email_address = email_address or _def
+ if (not use_gravatar or not email_address or email_address == _def):
f = lambda a, l: min(l, key=lambda x: abs(x - a))
return url("/images/user%s.png" % f(size, [14, 16, 20, 24, 30]))
- if(str2bool(config['app_conf'].get('use_gravatar')) and
- config['app_conf'].get('alternative_gravatar_url')):
+ if use_gravatar and config['app_conf'].get('alternative_gravatar_url'):
tmpl = config['app_conf'].get('alternative_gravatar_url', '')
parsed_url = urlparse.urlparse(url.current(qualified=True))
tmpl = tmpl.replace('{email}', email_address)\