# HG changeset patch # User Marcin Kuzminski # Date 2011-10-31 21:10:11 # Node ID bdb6fbc8265f9f090a9e0f779d62055136204c24 # Parent c0d8171ade3682512c6d64508554b3a951ff29e4 implements #293 gravatar link should be disabled when use_gravatar = false diff --git a/rhodecode/lib/base.py b/rhodecode/lib/base.py --- a/rhodecode/lib/base.py +++ b/rhodecode/lib/base.py @@ -10,6 +10,7 @@ from pylons.controllers.util import redi from pylons.templating import render_mako as render from rhodecode import __version__ +from rhodecode.lib import str2bool from rhodecode.lib.auth import AuthUser from rhodecode.lib.utils import get_repo_slug from rhodecode.model import meta @@ -24,6 +25,7 @@ class BaseController(WSGIController): def __before__(self): c.rhodecode_version = __version__ c.rhodecode_name = config.get('rhodecode_title') + c.use_gravatar = str2bool(config.get('use_gravatar')) c.ga_code = config.get('rhodecode_ga_code') c.repo_name = get_repo_slug(request) c.backends = BACKENDS.keys() @@ -32,8 +34,6 @@ class BaseController(WSGIController): self.sa = meta.Session() self.scm_model = ScmModel(self.sa) - #c.unread_journal = scm_model.get_unread_journal() - def __call__(self, environ, start_response): """Invoke the Controller""" # WSGIController.__call__ dispatches to the Controller method @@ -56,11 +56,13 @@ class BaseController(WSGIController): class BaseRepoController(BaseController): """ - Base class for controllers responsible for loading all needed data - for those controllers, loaded items are + Base class for controllers responsible for loading all needed data for + repository loaded items are - c.rhodecode_repo: instance of scm repository (taken from cache) - + c.rhodecode_repo: instance of scm repository + c.rhodecode_db_repo: instance of db + c.repository_followers: number of followers + c.repository_forks: number of forks """ def __before__(self): @@ -76,7 +78,6 @@ class BaseRepoController(BaseController) redirect(url('home')) - c.repository_followers = \ - self.scm_model.get_followers(c.repo_name) + c.repository_followers = self.scm_model.get_followers(c.repo_name) c.repository_forks = self.scm_model.get_forks(c.repo_name) diff --git a/rhodecode/lib/helpers.py b/rhodecode/lib/helpers.py --- a/rhodecode/lib/helpers.py +++ b/rhodecode/lib/helpers.py @@ -454,8 +454,8 @@ HasRepoPermissionAny, HasRepoPermissionA #============================================================================== def gravatar_url(email_address, size=30): - if not str2bool(config['app_conf'].get('use_gravatar')) or \ - email_address == 'anonymous@rhodecode.org': + if (not str2bool(config['app_conf'].get('use_gravatar')) or + not email_address or email_address == 'anonymous@rhodecode.org'): return url("/images/user%s.png" % size) ssl_enabled = 'https' == request.environ.get('wsgi.url_scheme') diff --git a/rhodecode/templates/admin/users/user_edit.html b/rhodecode/templates/admin/users/user_edit.html --- a/rhodecode/templates/admin/users/user_edit.html +++ b/rhodecode/templates/admin/users/user_edit.html @@ -29,10 +29,13 @@
gravatar
-

- ${_('Change your avatar at')} gravatar.com
- ${_('Using')} ${c.user.email} -

+

+ %if c.use_gravatar: + ${_('Change your avatar at')} gravatar.com +
${_('Using')} ${c.user.email} + %else: +
${c.user.email} + %endif

diff --git a/rhodecode/templates/admin/users/user_edit_my_account.html b/rhodecode/templates/admin/users/user_edit_my_account.html --- a/rhodecode/templates/admin/users/user_edit_my_account.html +++ b/rhodecode/templates/admin/users/user_edit_my_account.html @@ -29,8 +29,12 @@
gravatar

- ${_('Change your avatar at')} gravatar.com
- ${_('Using')} ${c.user.email} + %if c.use_gravatar: + ${_('Change your avatar at')} gravatar.com +
${_('Using')} ${c.user.email} + %else: +
${c.user.email} + %endif