# HG changeset patch # User Marcin Kuzminski # Date 2012-08-24 12:58:26 # Node ID 9d8f63ff921958ae9e51d797e938c04eac185b42 # Parent c25cc1c7c65f296ff72fce80e86a5666298b8477 # Parent d2f552429ef3bbbaa03e791fc50aa7a94c9b3c72 Merged in domruf/rhodecode (pull request #66) diff --git a/rhodecode/config/deployment.ini_tmpl b/rhodecode/config/deployment.ini_tmpl --- a/rhodecode/config/deployment.ini_tmpl +++ b/rhodecode/config/deployment.ini_tmpl @@ -63,6 +63,13 @@ cut_off_limit = 256000 force_https = false commit_parse_limit = 50 use_gravatar = true +## alternative_gravatar_url allows you to use your own avatar server application +## the following parts of the URL will be replaced +## %(email)s user email +## %(md5email)s md5 hash of the user email (like at gravatar.com) +## %(size)s size of the image that is expected from the server application +#alternative_gravatar_url = http://myavatarserver.com/getbyemail/%(email)s/%(size)s +#alternative_gravatar_url = http://myavatarserver.com/getbymd5/%(md5email)s?s=%(size)s container_auth_enabled = false proxypass_auth_enabled = false default_encoding = utf8 diff --git a/rhodecode/lib/helpers.py b/rhodecode/lib/helpers.py --- a/rhodecode/lib/helpers.py +++ b/rhodecode/lib/helpers.py @@ -711,6 +711,11 @@ HasRepoPermissionAny, HasRepoPermissionA #============================================================================== def gravatar_url(email_address, size=30): + if(str2bool(config['app_conf'].get('use_gravatar')) and + config['app_conf'].get('alternative_gravatar_url')): + return config['app_conf'].get('alternative_gravatar_url') % {'email': email_address, + 'md5email': hashlib.md5(email_address.lower()).hexdigest(), + 'size': size} 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))