Mercurial > kallithea
changeset 7252:af938280e76a
repos: document get_repos_as_dict parameters - repos_list is mandatory
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Mon, 23 Apr 2018 00:44:13 +0200 |
parents | 1b737e25266c |
children | 11f829761032 |
files | kallithea/controllers/admin/my_account.py kallithea/controllers/admin/repo_groups.py kallithea/controllers/admin/repos.py kallithea/controllers/home.py kallithea/controllers/journal.py kallithea/model/repo.py |
diffstat | 6 files changed, 13 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/controllers/admin/my_account.py Mon Apr 23 00:44:13 2018 +0200 +++ b/kallithea/controllers/admin/my_account.py Mon Apr 23 00:44:13 2018 +0200 @@ -82,8 +82,7 @@ .filter(Repository.owner_id == request.authuser.user_id).all() - return RepoModel().get_repos_as_dict(repos_list=repos_list, - admin=admin) + return RepoModel().get_repos_as_dict(repos_list, admin=admin) def my_account(self): c.active = 'profile'
--- a/kallithea/controllers/admin/repo_groups.py Mon Apr 23 00:44:13 2018 +0200 +++ b/kallithea/controllers/admin/repo_groups.py Mon Apr 23 00:44:13 2018 +0200 @@ -295,9 +295,9 @@ repo_groups_list = self.scm_model.get_repo_groups(groups) repos_list = Repository.query(sorted=True).filter_by(group=c.group).all() - c.data = RepoModel().get_repos_as_dict(repos_list=repos_list, + c.data = RepoModel().get_repos_as_dict(repos_list, repo_groups_list=repo_groups_list, - admin=False, short_name=True) + short_name=True) return render('admin/repo_groups/repo_group_show.html')
--- a/kallithea/controllers/admin/repos.py Mon Apr 23 00:44:13 2018 +0200 +++ b/kallithea/controllers/admin/repos.py Mon Apr 23 00:44:13 2018 +0200 @@ -102,7 +102,7 @@ c.repos_list = RepoList(_list, perm_level='admin') # the repo list will be filtered to only show repos where the user has read permissions - repos_data = RepoModel().get_repos_as_dict(repos_list=c.repos_list, admin=True) + repos_data = RepoModel().get_repos_as_dict(c.repos_list, admin=True) # data used to render the grid c.data = repos_data
--- a/kallithea/controllers/home.py Mon Apr 23 00:44:13 2018 +0200 +++ b/kallithea/controllers/home.py Mon Apr 23 00:44:13 2018 +0200 @@ -57,9 +57,9 @@ repo_groups_list = self.scm_model.get_repo_groups() repos_list = Repository.query(sorted=True).filter_by(group=None).all() - c.data = RepoModel().get_repos_as_dict(repos_list=repos_list, + c.data = RepoModel().get_repos_as_dict(repos_list, repo_groups_list=repo_groups_list, - admin=False, short_name=True) + short_name=True) return render('/index.html')
--- a/kallithea/controllers/journal.py Mon Apr 23 00:44:13 2018 +0200 +++ b/kallithea/controllers/journal.py Mon Apr 23 00:44:13 2018 +0200 @@ -214,8 +214,7 @@ repos_list = Repository.query(sorted=True) \ .filter_by(owner_id=request.authuser.user_id).all() - repos_data = RepoModel().get_repos_as_dict(repos_list=repos_list, - admin=True) + repos_data = RepoModel().get_repos_as_dict(repos_list, admin=True) # data used to render the grid c.data = repos_data
--- a/kallithea/model/repo.py Mon Apr 23 00:44:13 2018 +0200 +++ b/kallithea/model/repo.py Mon Apr 23 00:44:13 2018 +0200 @@ -149,9 +149,14 @@ kwargs.update(dict(_=_, h=h, c=c, request=request)) return tmpl.render(*args, **kwargs) - def get_repos_as_dict(self, repos_list=None, repo_groups_list=None, + def get_repos_as_dict(self, repos_list, repo_groups_list=None, admin=False, short_name=False): + """Return repository list for use by DataTable. + repos_list: list of repositories - but will be filtered for read permission. + repo_groups_list: added at top of list without permission check. + admin: return data for action column. + """ _render = self._render_datatable from tg import tmpl_context as c