Changeset - 7c30a3db0cdf
[Not reviewed]
default
0 3 0
Mads Kiilerich - 5 years ago 2020-10-29 11:04:49
mads@kiilerich.com
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.
3 files changed with 5 insertions and 17 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/admin/repos.py
Show inline comments
 
@@ -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
kallithea/controllers/forks.py
Show inline comments
 
@@ -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()
 

	
kallithea/lib/helpers.py
Show inline comments
 
@@ -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)
0 comments (0 inline, 0 general)