Mercurial > kallithea
changeset 795:ffd967053e4e beta
merged with ldap fix
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Tue, 30 Nov 2010 11:53:21 +0100 |
parents | 22eca93bea97 (current diff) 3025b0f9475e (diff) |
children | 81c173490971 |
files | |
diffstat | 4 files changed, 39 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- a/rhodecode/controllers/journal.py Mon Nov 29 13:55:47 2010 +0100 +++ b/rhodecode/controllers/journal.py Tue Nov 30 11:53:21 2010 +0100 @@ -25,10 +25,9 @@ from pylons import request, response, session, tmpl_context as c, url from pylons.controllers.util import abort, redirect -from rhodecode.lib.auth import LoginRequired +from rhodecode.lib.auth import LoginRequired, NotAnonymous from rhodecode.lib.base import BaseController, render from rhodecode.lib.helpers import get_token -from rhodecode.lib.utils import action_logger from rhodecode.model.db import UserLog, UserFollowing from rhodecode.model.scm import ScmModel from sqlalchemy import or_ @@ -41,6 +40,7 @@ @LoginRequired() + @NotAnonymous() def __before__(self): super(JournalController, self).__before__() @@ -49,12 +49,12 @@ c.following = self.sa.query(UserFollowing)\ .filter(UserFollowing.user_id == c.rhodecode_user.user_id).all() - - repo_ids = [x.follows_repository.repo_id for x in c.following + + repo_ids = [x.follows_repository.repo_id for x in c.following if x.follows_repository is not None] - user_ids = [x.follows_user.user_id for x in c.following + user_ids = [x.follows_user.user_id for x in c.following if x.follows_user is not None] - + c.journal = self.sa.query(UserLog)\ .filter(or_( UserLog.repository_id.in_(repo_ids), @@ -65,7 +65,6 @@ .all() return render('/journal.html') - def toggle_following(self): if request.POST.get('auth_token') == get_token():
--- a/rhodecode/model/scm.py Mon Nov 29 13:55:47 2010 +0100 +++ b/rhodecode/model/scm.py Tue Nov 30 11:53:21 2010 +0100 @@ -170,19 +170,6 @@ 'repository.admin')(repo_name, 'get repo check'): return - pre_invalidate = True - if invalidation_list is not None: - pre_invalidate = repo_name in invalidation_list - - if pre_invalidate: - invalidate = self._should_invalidate(repo_name) - - if invalidate: - log.info('invalidating cache for repository %s', repo_name) - region_invalidate(_get_repo, None, repo_name) - self._mark_invalidated(invalidate) - - #====================================================================== # CACHE FUNCTION #====================================================================== @@ -224,6 +211,18 @@ repo.dbrepo = dbrepo return repo + pre_invalidate = True + if invalidation_list is not None: + pre_invalidate = repo_name in invalidation_list + + if pre_invalidate: + invalidate = self._should_invalidate(repo_name) + + if invalidate: + log.info('invalidating cache for repository %s', repo_name) + region_invalidate(_get_repo, None, repo_name) + self._mark_invalidated(invalidate) + return _get_repo(repo_name)
--- a/rhodecode/templates/base/base.html Mon Nov 29 13:55:47 2010 +0100 +++ b/rhodecode/templates/base/base.html Tue Nov 30 11:53:21 2010 +0100 @@ -22,7 +22,12 @@ </div> <div class="account"> %if c.rhodecode_user.username == 'default': - ${h.link_to('anonymous',h.url('register'),title='%s %s'%(c.rhodecode_user.name,c.rhodecode_user.lastname))} + %if h.HasPermissionAny('hg.admin', 'hg.register.auto_activate', 'hg.register.manual_activate')(): + ${h.link_to('anonymous',h.url('register'),title='%s %s'%(c.rhodecode_user.name,c.rhodecode_user.lastname))} + %else: + ${h.link_to('anonymous',h.url('#'),title='%s %s'%(c.rhodecode_user.name,c.rhodecode_user.lastname))} + %endif + %else: ${h.link_to(c.rhodecode_user.username,h.url('admin_settings_my_account'),title='%s %s'%(c.rhodecode_user.name,c.rhodecode_user.lastname))} %endif @@ -31,10 +36,12 @@ <li> <a href="${h.url('home')}">${_('Home')}</a> </li> + %if c.rhodecode_user.username != 'default': <li> <a href="${h.url('journal')}">${_('Journal')}</a> ##(${c.unread_journal})</a> </li> + %endif %if c.rhodecode_user.username == 'default': <li class="last highlight">${h.link_to(u'Login',h.url('login_home'))}</li> %else: @@ -257,7 +264,7 @@ <span>${_('Home')}</span> </a> </li> - + %if c.rhodecode_user.username != 'default': <li> <a title="${_('Journal')}" href="${h.url('journal')}"> <span class="icon"> @@ -266,7 +273,7 @@ <span>${_('Journal')}</span> </a> </li> - + %endif <li> <a title="${_('Search')}" href="${h.url('search')}"> <span class="icon">
--- a/rhodecode/templates/summary/summary.html Mon Nov 29 13:55:47 2010 +0100 +++ b/rhodecode/templates/summary/summary.html Tue Nov 30 11:53:21 2010 +0100 @@ -44,16 +44,17 @@ <img style="margin-bottom:2px" class="icon" title="${_('public repository')}" alt="${_('public repository')}" src="/images/icons/lock_open.png"/> %endif <span style="font-size: 1.6em;font-weight: bold;vertical-align: baseline;">${c.repo_info.name}</span> - - %if c.following: - <span id="follow_toggle" class="following" title="${_('Stop following this repository')}" - onclick="javascript:toggleFollowingRepo(${c.repo_info.dbrepo.repo_id},'${str(h.get_token())}')"> - </span> - %else: - <span id="follow_toggle" class="follow" title="${_('Start following this repository')}" - onclick="javascript:toggleFollowingRepo(${c.repo_info.dbrepo.repo_id},'${str(h.get_token())}')"> - </span> - %endif + %if c.rhodecode_user.username != 'default': + %if c.following: + <span id="follow_toggle" class="following" title="${_('Stop following this repository')}" + onclick="javascript:toggleFollowingRepo(${c.repo_info.dbrepo.repo_id},'${str(h.get_token())}')"> + </span> + %else: + <span id="follow_toggle" class="follow" title="${_('Start following this repository')}" + onclick="javascript:toggleFollowingRepo(${c.repo_info.dbrepo.repo_id},'${str(h.get_token())}')"> + </span> + %endif + %endif: <br/> %if c.repo_info.dbrepo.fork: <span style="margin-top:5px">