diff options
author | Marcin Kuzminski <marcin@python-works.com> | 2013-02-12 23:15:55 +0100 |
---|---|---|
committer | Marcin Kuzminski <marcin@python-works.com> | 2013-02-12 23:15:55 +0100 |
commit | 9f2b1fd8b2e3c51212ffd709032dd51602248c42 (patch) | |
tree | cb862f46367770c88f2d4378f4a9e68b68d3a2f4 | |
parent | 920bb05d6b6351bdaa8390cd1b08a4243f20d1b7 (diff) |
#763 gravatar helper function should fallback into default image if somehow email provided is empty.
--HG--
extra : source : e6c551663a54ace461db238cdf3064c6a74dafe1
-rw-r--r-- | rhodecode/lib/helpers.py | 10 |
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)\ |