Changeset - 39bbe5d31a54
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 13 years ago 2012-12-08 19:09:12
marcin@python-works.com
fixes issue #674, alternative gravatar url had an error when there was no valid email in commit data
1 file changed with 7 insertions and 6 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/helpers.py
Show inline comments
 
@@ -749,7 +749,13 @@ HasRepoPermissionAny, HasRepoPermissionA
 
#==============================================================================
 

	
 
def gravatar_url(email_address, size=30):
 
    from pylons import url  ## doh, we need to re-import url to mock it later
 
    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'):
 
        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')):
 
        tmpl = config['app_conf'].get('alternative_gravatar_url', '')
 
@@ -761,11 +767,6 @@ def gravatar_url(email_address, size=30)
 
                   .replace('{size}', str(size))
 
        return tmpl
 

	
 
    if (not str2bool(config['app_conf'].get('use_gravatar')) or
 
        not email_address or email_address == 'anonymous@rhodecode.org'):
 
        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]))
 

	
 
    ssl_enabled = 'https' == request.environ.get('wsgi.url_scheme')
 
    default = 'identicon'
 
    baseurl_nossl = "http://www.gravatar.com/avatar/"
0 comments (0 inline, 0 general)