# HG changeset patch # User Marcin Kuzminski # Date 2011-02-13 01:48:02 # Node ID 8e49b6ceffe1e6116f84563843835a6387cc2de9 # Parent 51b70569c330e0c5df786ad7e73eaa89ae625a80 fixes fixes fixes ! optimized queries on journal added some logging, fixed found bugs due to previous refactorings diff --git a/rhodecode/controllers/admin/admin.py b/rhodecode/controllers/admin/admin.py --- a/rhodecode/controllers/admin/admin.py +++ b/rhodecode/controllers/admin/admin.py @@ -26,11 +26,14 @@ # MA 02110-1301, USA. import logging + from pylons import request, tmpl_context as c +from sqlalchemy.orm import joinedload +from webhelpers.paginate import Page + +from rhodecode.lib.auth import LoginRequired, HasPermissionAllDecorator from rhodecode.lib.base import BaseController, render from rhodecode.model.db import UserLog -from webhelpers.paginate import Page -from rhodecode.lib.auth import LoginRequired, HasPermissionAllDecorator log = logging.getLogger(__name__) @@ -43,7 +46,11 @@ class AdminController(BaseController): @HasPermissionAllDecorator('hg.admin') def index(self): - users_log = self.sa.query(UserLog).order_by(UserLog.action_date.desc()) + users_log = self.sa.query(UserLog)\ + .options(joinedload(UserLog.user))\ + .options(joinedload(UserLog.repository))\ + .order_by(UserLog.action_date.desc()) + p = int(request.params.get('page', 1)) c.users_log = Page(users_log, page=p, items_per_page=10) c.log_data = render('admin/admin_log.html') diff --git a/rhodecode/lib/auth.py b/rhodecode/lib/auth.py --- a/rhodecode/lib/auth.py +++ b/rhodecode/lib/auth.py @@ -600,7 +600,7 @@ class HasPermissionAnyMiddleware(object) def check_permissions(self): log.debug('checking mercurial protocol ' - 'permissions for user:%s repository:%s', + 'permissions %s for user:%s repository:%s', self.user_perms, self.username, self.repo_name) if self.required_perms.intersection(self.user_perms): log.debug('permission granted') diff --git a/rhodecode/lib/helpers.py b/rhodecode/lib/helpers.py --- a/rhodecode/lib/helpers.py +++ b/rhodecode/lib/helpers.py @@ -441,9 +441,8 @@ def action_parser(user_log): revs = action_params.split(',') repo_name = user_log.repository.repo_name from rhodecode.model.scm import ScmModel - - message = lambda rev: get_changeset_safe(ScmModel().get(repo_name), - rev).message + repo, dbrepo = ScmModel().get(repo_name, retval='repo') + message = lambda rev: get_changeset_safe(repo, rev).message cs_links = " " + ', '.join ([link_to(rev, url('changeset_home',