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