Mercurial > kallithea
changeset 3469:2cd0c8251aa2
#763 gravatar helper function should fallback into default image if somehow email provided is empty.
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Tue, 12 Feb 2013 23:15:55 +0100 |
parents | bbd72d82060a |
children | 649ca0cc8a08 |
files | rhodecode/lib/helpers.py |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/rhodecode/lib/helpers.py Mon Feb 25 21:27:52 2013 +0100 +++ b/rhodecode/lib/helpers.py Tue Feb 12 23:15:55 2013 +0100 @@ -750,14 +750,14 @@ 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)\