Mercurial > kallithea
changeset 6848:e6e69ed2c89e
summary: inline _load_changelog_summary
It makes more sense to have this summary specific code in the summary
controller.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Sun, 27 Aug 2017 17:11:03 +0200 |
parents | dbc009ab5af3 |
children | f92d08061a24 |
files | kallithea/controllers/changelog.py kallithea/controllers/summary.py |
diffstat | 2 files changed, 9 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/controllers/changelog.py Sun Aug 27 17:00:57 2017 +0200 +++ b/kallithea/controllers/changelog.py Sun Aug 27 17:11:03 2017 +0200 @@ -46,17 +46,6 @@ log = logging.getLogger(__name__) -def _load_changelog_summary(): - # only used from summary ... - p = safe_int(request.GET.get('page'), 1) - size = safe_int(request.GET.get('size'), 10) - collection = c.db_repo_scm_instance - c.cs_pagination = RepoPage(collection, page=p, items_per_page=size) - page_revisions = [x.raw_id for x in list(c.cs_pagination)] - c.cs_comments = c.db_repo.get_comments(page_revisions) - c.cs_statuses = c.db_repo.statuses(page_revisions) - - class ChangelogController(BaseRepoController): def _before(self, *args, **kwargs):
--- a/kallithea/controllers/summary.py Sun Aug 27 17:00:57 2017 +0200 +++ b/kallithea/controllers/summary.py Sun Aug 27 17:11:03 2017 +0200 @@ -42,7 +42,7 @@ NodeDoesNotExistError from kallithea.config.conf import ALL_READMES, ALL_EXTS, LANGUAGES_EXTENSIONS_MAP from kallithea.model.db import Statistics, CacheInvalidation, User -from kallithea.lib.utils2 import safe_str +from kallithea.lib.utils2 import safe_int, safe_str from kallithea.lib.auth import LoginRequired, HasRepoPermissionLevelDecorator, \ NotAnonymous from kallithea.lib.base import BaseRepoController, render, jsonify @@ -51,7 +51,7 @@ from kallithea.lib.celerylib.tasks import get_commits_stats from kallithea.lib.compat import json from kallithea.lib.vcs.nodes import FileNode -from kallithea.controllers.changelog import _load_changelog_summary +from kallithea.lib.page import RepoPage log = logging.getLogger(__name__) @@ -106,7 +106,13 @@ @LoginRequired() @HasRepoPermissionLevelDecorator('read') def index(self, repo_name): - _load_changelog_summary() + p = safe_int(request.GET.get('page'), 1) + size = safe_int(request.GET.get('size'), 10) + collection = c.db_repo_scm_instance + c.cs_pagination = RepoPage(collection, page=p, items_per_page=size) + page_revisions = [x.raw_id for x in list(c.cs_pagination)] + c.cs_comments = c.db_repo.get_comments(page_revisions) + c.cs_statuses = c.db_repo.statuses(page_revisions) if request.authuser.is_default_user: username = ''