# HG changeset patch # User Mads Kiilerich # Date 2015-07-24 16:37:40 # Node ID ab5c4d84f99c33c32b5d6726a958d78d644bc8d3 # Parent 63bed817308c7cd9829fede0036ef2a640a744bb repos: fix abuse of dead 'repo' routing The repo "show" controller didn't do anything and was unused. There was a routing GET entry for it but it was only used for generating URLs for DELETE and PUT operations that have separate controllers that happen to have the same URL. Use the right routing entries when generating URLs and drop the dead code. diff --git a/kallithea/config/routing.py b/kallithea/config/routing.py --- a/kallithea/config/routing.py +++ b/kallithea/config/routing.py @@ -120,15 +120,12 @@ def make_map(config): action="index", conditions=dict(method=["GET"])) m.connect("new_repo", "/create_repository", action="create_repository", conditions=dict(method=["GET"])) - m.connect("/repos/{repo_name:.*?}", + m.connect("put_repo", "/repos/{repo_name:.*?}", action="update", conditions=dict(method=["PUT"], function=check_repo)) m.connect("delete_repo", "/repos/{repo_name:.*?}", action="delete", conditions=dict(method=["DELETE"], )) - m.connect("repo", "/repos/{repo_name:.*?}", - action="show", conditions=dict(method=["GET"], - function=check_repo)) #ADMIN REPOSITORY GROUPS ROUTES with rmap.submapper(path_prefix=ADMIN_PREFIX, diff --git a/kallithea/controllers/admin/repos.py b/kallithea/controllers/admin/repos.py --- a/kallithea/controllers/admin/repos.py +++ b/kallithea/controllers/admin/repos.py @@ -234,9 +234,9 @@ class ReposController(BaseRepoController # Forms posted to this method should contain a hidden field: # # Or using helpers: - # h.form(url('repo', repo_name=ID), + # h.form(url('put_repo', repo_name=ID), # method='put') - # url('repo', repo_name=ID) + # url('put_repo', repo_name=ID) c.repo_info = self._load_repo(repo_name) self.__load_defaults(c.repo_info) c.active = 'settings' @@ -291,9 +291,9 @@ class ReposController(BaseRepoController # Forms posted to this method should contain a hidden field: # # Or using helpers: - # h.form(url('repo', repo_name=ID), + # h.form(url('delete_repo', repo_name=ID), # method='delete') - # url('repo', repo_name=ID) + # url('delete_repo', repo_name=ID) repo_model = RepoModel() repo = repo_model.get_by_repo_name(repo_name) @@ -330,11 +330,6 @@ class ReposController(BaseRepoController return redirect(url('repos_group_home', group_name=repo.group.group_name)) return redirect(url('repos')) - @HasPermissionAllDecorator('hg.admin') - def show(self, repo_name, format='html'): - """GET /repos/repo_name: Show a specific item""" - # url('repo', repo_name=ID) - @HasRepoPermissionAllDecorator('repository.admin') def edit(self, repo_name): """GET /repo_name/settings: Form to edit an existing item""" diff --git a/kallithea/templates/admin/repos/repo_edit_advanced.html b/kallithea/templates/admin/repos/repo_edit_advanced.html --- a/kallithea/templates/admin/repos/repo_edit_advanced.html +++ b/kallithea/templates/admin/repos/repo_edit_advanced.html @@ -73,7 +73,7 @@ ${h.form(url('edit_repo_advanced_locking ${h.end_form()}

${_('Delete')}

-${h.form(url('repo', repo_name=c.repo_name),method='delete')} +${h.form(url('delete_repo', repo_name=c.repo_name), method='delete')}