##// END OF EJS Templates
#763 gravatar helper function should fallback into default image if somehow email provided is empty.
marcink -
r3367:e6c55166 beta
parent child Browse files
Show More
@@ -751,14 +751,14 b' HasReposGroupPermissionAny'
751 751
752 752 def gravatar_url(email_address, size=30):
753 753 from pylons import url # doh, we need to re-import url to mock it later
754
755 if (not str2bool(config['app_conf'].get('use_gravatar')) or
756 not email_address or email_address == 'anonymous@rhodecode.org'):
754 _def = 'anonymous@rhodecode.org'
755 use_gravatar = str2bool(config['app_conf'].get('use_gravatar'))
756 email_address = email_address or _def
757 if (not use_gravatar or not email_address or email_address == _def):
757 758 f = lambda a, l: min(l, key=lambda x: abs(x - a))
758 759 return url("/images/user%s.png" % f(size, [14, 16, 20, 24, 30]))
759 760
760 if(str2bool(config['app_conf'].get('use_gravatar')) and
761 config['app_conf'].get('alternative_gravatar_url')):
761 if use_gravatar and config['app_conf'].get('alternative_gravatar_url'):
762 762 tmpl = config['app_conf'].get('alternative_gravatar_url', '')
763 763 parsed_url = urlparse.urlparse(url.current(qualified=True))
764 764 tmpl = tmpl.replace('{email}', email_address)\
General Comments 0
You need to be logged in to leave comments. Login now