app: dropped deprecated controllers to view_utils which are actually proper name
This commit is contained in:
parent
830d1820e6
commit
8affc5f5be
7 changed files with 14 additions and 31 deletions
|
|
@ -30,7 +30,7 @@ from rhodecode.lib.auth import (
|
|||
HasPermissionAnyApi, HasRepoPermissionAnyApi, HasRepoGroupPermissionAnyApi)
|
||||
from rhodecode.lib.utils import safe_unicode
|
||||
from rhodecode.lib.vcs.exceptions import RepositoryError
|
||||
from rhodecode.controllers.utils import get_commit_from_ref_name
|
||||
from rhodecode.lib.view_utils import get_commit_from_ref_name
|
||||
from rhodecode.lib.utils2 import str2bool
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
|
|
|||
|
|
@ -27,12 +27,13 @@ from pyramid.renderers import render
|
|||
from pyramid.response import Response
|
||||
|
||||
from rhodecode.apps._base import RepoAppView
|
||||
from rhodecode.controllers.utils import parse_path_ref, get_commit_from_ref_name
|
||||
|
||||
from rhodecode.lib import helpers as h
|
||||
from rhodecode.lib import diffs, codeblocks
|
||||
from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
|
||||
from rhodecode.lib.utils import safe_str
|
||||
from rhodecode.lib.utils2 import safe_unicode, str2bool
|
||||
from rhodecode.lib.view_utils import parse_path_ref, get_commit_from_ref_name
|
||||
from rhodecode.lib.vcs.exceptions import (
|
||||
EmptyRepositoryError, RepositoryError, RepositoryRequirementError,
|
||||
NodeDoesNotExistError)
|
||||
|
|
|
|||
|
|
@ -33,9 +33,10 @@ from pyramid.response import Response
|
|||
import rhodecode
|
||||
from rhodecode.apps._base import RepoAppView
|
||||
|
||||
from rhodecode.controllers.utils import parse_path_ref
|
||||
|
||||
from rhodecode.lib import diffs, helpers as h, rc_cache
|
||||
from rhodecode.lib import audit_logger
|
||||
from rhodecode.lib.view_utils import parse_path_ref
|
||||
from rhodecode.lib.exceptions import NonRelativePathError
|
||||
from rhodecode.lib.codeblocks import (
|
||||
filenode_as_lines_tokens, filenode_as_annotated_lines_tokens)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import rhodecode
|
|||
|
||||
from pyramid.view import view_config
|
||||
|
||||
from rhodecode.controllers import utils
|
||||
from rhodecode.lib.view_utils import get_format_ref_id
|
||||
from rhodecode.apps._base import RepoAppView
|
||||
from rhodecode.config.conf import (LANGUAGES_EXTENSIONS_MAP)
|
||||
from rhodecode.lib import helpers as h, rc_cache
|
||||
|
|
@ -351,7 +351,7 @@ class RepoSummaryView(RepoAppView):
|
|||
return data
|
||||
|
||||
def _create_reference_data(self, repo, full_repo_name, refs_to_create):
|
||||
format_ref_id = utils.get_format_ref_id(repo)
|
||||
format_ref_id = get_format_ref_id(repo)
|
||||
|
||||
result = []
|
||||
for title, refs, ref_type in refs_to_create:
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (C) 2010-2018 RhodeCode GmbH
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License, version 3
|
||||
# (only), as published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# This program is dual-licensed. If you wish to learn more about the
|
||||
# RhodeCode Enterprise Edition, including its added features, Support services,
|
||||
# and proprietary license terms, please see https://rhodecode.com/licenses/
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
import pytest
|
||||
|
||||
from rhodecode.controllers import utils
|
||||
from rhodecode.lib import view_utils
|
||||
from rhodecode.lib.vcs.exceptions import RepositoryError
|
||||
import mock
|
||||
|
||||
|
|
@ -34,11 +34,11 @@ def test_parse_path_ref_understands_format_ref_id_result(alias, expected):
|
|||
repo = mock.Mock(alias=alias)
|
||||
|
||||
# Formatting of reference ids as it is used by controllers
|
||||
format_ref_id = utils.get_format_ref_id(repo)
|
||||
format_ref_id = view_utils.get_format_ref_id(repo)
|
||||
formatted_ref_id = format_ref_id(name='name', raw_id='raw_id')
|
||||
|
||||
# Parsing such a reference back as it is used by controllers
|
||||
result = utils.parse_path_ref(formatted_ref_id)
|
||||
result = view_utils.parse_path_ref(formatted_ref_id)
|
||||
|
||||
assert list(result) == expected
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ def test_parse_path_ref_understands_format_ref_id_result(alias, expected):
|
|||
('p@a', None, ('p', 'a')),
|
||||
])
|
||||
def test_parse_path_ref(ref, default_path, expected):
|
||||
result = utils.parse_path_ref(ref, default_path)
|
||||
result = view_utils.parse_path_ref(ref, default_path)
|
||||
assert list(result) == list(expected)
|
||||
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ def test_parse_path_ref(ref, default_path, expected):
|
|||
])
|
||||
def test_format_ref_id(alias, expected):
|
||||
repo = mock.Mock(alias=alias)
|
||||
format_ref_id = utils.get_format_ref_id(repo)
|
||||
format_ref_id = view_utils.get_format_ref_id(repo)
|
||||
result = format_ref_id(name='name', raw_id='raw_id')
|
||||
assert result == expected
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ class TestGetCommit(object):
|
|||
scm_instance.bookmarks = {ref_name: 'a_book_id'}
|
||||
|
||||
scm_instance.get_commit.return_value = 'test'
|
||||
commit = utils.get_commit_from_ref_name(repo, ref_name, ref_type)
|
||||
commit = view_utils.get_commit_from_ref_name(repo, ref_name, ref_type)
|
||||
scm_instance.get_commit.assert_called_once_with('a_%s_id' % ref_type)
|
||||
assert commit == 'test'
|
||||
|
||||
|
|
@ -90,4 +90,4 @@ class TestGetCommit(object):
|
|||
repo.scm_instance().tags = {}
|
||||
repo.scm_instance().bookmarks = {}
|
||||
with pytest.raises(RepositoryError):
|
||||
utils.get_commit_from_ref_name(repo, ref_name, ref_type)
|
||||
view_utils.get_commit_from_ref_name(repo, ref_name, ref_type)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue