changeset 8714:7c30a3db0cdf

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.
author Mads Kiilerich <mads@kiilerich.com>
date Thu, 29 Oct 2020 11:04:49 +0100
parents 180effeba219
children b095a92a4312
files kallithea/controllers/admin/repos.py kallithea/controllers/forks.py kallithea/lib/helpers.py
diffstat 3 files changed, 5 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/controllers/admin/repos.py	Fri Oct 30 15:26:03 2020 +0100
+++ b/kallithea/controllers/admin/repos.py	Thu Oct 29 11:04:49 2020 +0100
@@ -64,8 +64,7 @@
         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 @@
         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
--- a/kallithea/controllers/forks.py	Fri Oct 30 15:26:03 2020 +0100
+++ b/kallithea/controllers/forks.py	Thu Oct 29 11:04:49 2020 +0100
@@ -33,7 +33,7 @@
 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.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 @@
         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 @@
     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()
 
--- a/kallithea/lib/helpers.py	Fri Oct 30 15:26:03 2020 +0100
+++ b/kallithea/lib/helpers.py	Thu Oct 29 11:04:49 2020 +0100
@@ -1337,13 +1337,6 @@
     '''))
 
 
-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)