# HG changeset patch # User Mads Kiilerich # Date 2020-10-29 11:04:49 # Node ID 7c30a3db0cdf7430a75035b787229e2d9403160f # Parent 180effeba21935b9e253e03dab4faa06739f924a lib: drop sparsely used h.not_mapped_error It might be a good idea, but then we should use it much more consistently ... and it should probably be done differently. Let's keep it simple and be consistent. 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 @@ -64,8 +64,7 @@ class ReposController(BaseRepoController repo_obj = c.db_repo if repo_obj is None: - h.not_mapped_error(c.repo_name) - raise HTTPFound(location=url('repos')) + raise HTTPNotFound() return repo_obj @@ -249,8 +248,7 @@ class ReposController(BaseRepoController repo_model = RepoModel() repo = repo_model.get_by_repo_name(repo_name) if not repo: - h.not_mapped_error(repo_name) - raise HTTPFound(location=url('repos')) + raise HTTPNotFound() try: _forks = repo.forks.count() handle_forks = None diff --git a/kallithea/controllers/forks.py b/kallithea/controllers/forks.py --- a/kallithea/controllers/forks.py +++ b/kallithea/controllers/forks.py @@ -33,7 +33,7 @@ from formencode import htmlfill from tg import request from tg import tmpl_context as c from tg.i18n import ugettext as _ -from webob.exc import HTTPFound +from webob.exc import HTTPFound, HTTPNotFound import kallithea import kallithea.lib.helpers as h @@ -41,7 +41,6 @@ from kallithea.lib.auth import HasPermis from kallithea.lib.base import BaseRepoController, render from kallithea.lib.page import Page from kallithea.lib.utils2 import safe_int -from kallithea.lib.webutils import url from kallithea.model import db from kallithea.model.forms import RepoForkForm from kallithea.model.repo import RepoModel @@ -70,8 +69,7 @@ class ForksController(BaseRepoController repo = c.db_repo.scm_instance if c.repo_info is None: - h.not_mapped_error(c.repo_name) - raise HTTPFound(location=url('repos')) + raise HTTPNotFound() c.default_user_id = kallithea.DEFAULT_USER_ID c.in_public_journal = db.UserFollowing.query() \ @@ -125,8 +123,7 @@ class ForksController(BaseRepoController def fork(self, repo_name): c.repo_info = db.Repository.get_by_repo_name(repo_name) if not c.repo_info: - h.not_mapped_error(repo_name) - raise HTTPFound(location=url('home')) + raise HTTPNotFound() defaults = self.__load_data() diff --git a/kallithea/lib/helpers.py b/kallithea/lib/helpers.py --- a/kallithea/lib/helpers.py +++ b/kallithea/lib/helpers.py @@ -1337,13 +1337,6 @@ def journal_filter_help(): ''')) -def not_mapped_error(repo_name): - flash(_('%s repository is not mapped to db perhaps' - ' it was created or renamed from the filesystem' - ' please run the application again' - ' in order to rescan repositories') % repo_name, category='error') - - def ip_range(ip_addr): s, e = db.UserIpMap._get_ip_range(ip_addr) return '%s - %s' % (s, e)