Show More
@@ -30,7 +30,7 b' from rhodecode.lib.auth import (' | |||||
30 | HasPermissionAnyApi, HasRepoPermissionAnyApi, HasRepoGroupPermissionAnyApi) |
|
30 | HasPermissionAnyApi, HasRepoPermissionAnyApi, HasRepoGroupPermissionAnyApi) | |
31 | from rhodecode.lib.utils import safe_unicode |
|
31 | from rhodecode.lib.utils import safe_unicode | |
32 | from rhodecode.lib.vcs.exceptions import RepositoryError |
|
32 | from rhodecode.lib.vcs.exceptions import RepositoryError | |
33 |
from rhodecode. |
|
33 | from rhodecode.lib.view_utils import get_commit_from_ref_name | |
34 | from rhodecode.lib.utils2 import str2bool |
|
34 | from rhodecode.lib.utils2 import str2bool | |
35 |
|
35 | |||
36 | log = logging.getLogger(__name__) |
|
36 | log = logging.getLogger(__name__) |
@@ -27,12 +27,13 b' from pyramid.renderers import render' | |||||
27 | from pyramid.response import Response |
|
27 | from pyramid.response import Response | |
28 |
|
28 | |||
29 | from rhodecode.apps._base import RepoAppView |
|
29 | from rhodecode.apps._base import RepoAppView | |
30 | from rhodecode.controllers.utils import parse_path_ref, get_commit_from_ref_name |
|
30 | ||
31 | from rhodecode.lib import helpers as h |
|
31 | from rhodecode.lib import helpers as h | |
32 | from rhodecode.lib import diffs, codeblocks |
|
32 | from rhodecode.lib import diffs, codeblocks | |
33 | from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator |
|
33 | from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator | |
34 | from rhodecode.lib.utils import safe_str |
|
34 | from rhodecode.lib.utils import safe_str | |
35 | from rhodecode.lib.utils2 import safe_unicode, str2bool |
|
35 | from rhodecode.lib.utils2 import safe_unicode, str2bool | |
|
36 | from rhodecode.lib.view_utils import parse_path_ref, get_commit_from_ref_name | |||
36 | from rhodecode.lib.vcs.exceptions import ( |
|
37 | from rhodecode.lib.vcs.exceptions import ( | |
37 | EmptyRepositoryError, RepositoryError, RepositoryRequirementError, |
|
38 | EmptyRepositoryError, RepositoryError, RepositoryRequirementError, | |
38 | NodeDoesNotExistError) |
|
39 | NodeDoesNotExistError) |
@@ -33,9 +33,10 b' from pyramid.response import Response' | |||||
33 | import rhodecode |
|
33 | import rhodecode | |
34 | from rhodecode.apps._base import RepoAppView |
|
34 | from rhodecode.apps._base import RepoAppView | |
35 |
|
35 | |||
36 | from rhodecode.controllers.utils import parse_path_ref |
|
36 | ||
37 | from rhodecode.lib import diffs, helpers as h, rc_cache |
|
37 | from rhodecode.lib import diffs, helpers as h, rc_cache | |
38 | from rhodecode.lib import audit_logger |
|
38 | from rhodecode.lib import audit_logger | |
|
39 | from rhodecode.lib.view_utils import parse_path_ref | |||
39 | from rhodecode.lib.exceptions import NonRelativePathError |
|
40 | from rhodecode.lib.exceptions import NonRelativePathError | |
40 | from rhodecode.lib.codeblocks import ( |
|
41 | from rhodecode.lib.codeblocks import ( | |
41 | filenode_as_lines_tokens, filenode_as_annotated_lines_tokens) |
|
42 | filenode_as_lines_tokens, filenode_as_annotated_lines_tokens) |
@@ -24,7 +24,7 b' import rhodecode' | |||||
24 |
|
24 | |||
25 | from pyramid.view import view_config |
|
25 | from pyramid.view import view_config | |
26 |
|
26 | |||
27 |
from rhodecode. |
|
27 | from rhodecode.lib.view_utils import get_format_ref_id | |
28 | from rhodecode.apps._base import RepoAppView |
|
28 | from rhodecode.apps._base import RepoAppView | |
29 | from rhodecode.config.conf import (LANGUAGES_EXTENSIONS_MAP) |
|
29 | from rhodecode.config.conf import (LANGUAGES_EXTENSIONS_MAP) | |
30 | from rhodecode.lib import helpers as h, rc_cache |
|
30 | from rhodecode.lib import helpers as h, rc_cache | |
@@ -351,7 +351,7 b' class RepoSummaryView(RepoAppView):' | |||||
351 | return data |
|
351 | return data | |
352 |
|
352 | |||
353 | def _create_reference_data(self, repo, full_repo_name, refs_to_create): |
|
353 | def _create_reference_data(self, repo, full_repo_name, refs_to_create): | |
354 |
format_ref_id = |
|
354 | format_ref_id = get_format_ref_id(repo) | |
355 |
|
355 | |||
356 | result = [] |
|
356 | result = [] | |
357 | for title, refs, ref_type in refs_to_create: |
|
357 | for title, refs, ref_type in refs_to_create: |
1 | NO CONTENT: file renamed from rhodecode/controllers/utils.py to rhodecode/lib/view_utils.py |
|
NO CONTENT: file renamed from rhodecode/controllers/utils.py to rhodecode/lib/view_utils.py |
@@ -20,7 +20,7 b'' | |||||
20 |
|
20 | |||
21 | import pytest |
|
21 | import pytest | |
22 |
|
22 | |||
23 |
from rhodecode. |
|
23 | from rhodecode.lib import view_utils | |
24 | from rhodecode.lib.vcs.exceptions import RepositoryError |
|
24 | from rhodecode.lib.vcs.exceptions import RepositoryError | |
25 | import mock |
|
25 | import mock | |
26 |
|
26 | |||
@@ -34,11 +34,11 b' def test_parse_path_ref_understands_form' | |||||
34 | repo = mock.Mock(alias=alias) |
|
34 | repo = mock.Mock(alias=alias) | |
35 |
|
35 | |||
36 | # Formatting of reference ids as it is used by controllers |
|
36 | # Formatting of reference ids as it is used by controllers | |
37 | format_ref_id = utils.get_format_ref_id(repo) |
|
37 | format_ref_id = view_utils.get_format_ref_id(repo) | |
38 | formatted_ref_id = format_ref_id(name='name', raw_id='raw_id') |
|
38 | formatted_ref_id = format_ref_id(name='name', raw_id='raw_id') | |
39 |
|
39 | |||
40 | # Parsing such a reference back as it is used by controllers |
|
40 | # Parsing such a reference back as it is used by controllers | |
41 | result = utils.parse_path_ref(formatted_ref_id) |
|
41 | result = view_utils.parse_path_ref(formatted_ref_id) | |
42 |
|
42 | |||
43 | assert list(result) == expected |
|
43 | assert list(result) == expected | |
44 |
|
44 | |||
@@ -50,7 +50,7 b' def test_parse_path_ref_understands_form' | |||||
50 | ('p@a', None, ('p', 'a')), |
|
50 | ('p@a', None, ('p', 'a')), | |
51 | ]) |
|
51 | ]) | |
52 | def test_parse_path_ref(ref, default_path, expected): |
|
52 | def test_parse_path_ref(ref, default_path, expected): | |
53 | result = utils.parse_path_ref(ref, default_path) |
|
53 | result = view_utils.parse_path_ref(ref, default_path) | |
54 | assert list(result) == list(expected) |
|
54 | assert list(result) == list(expected) | |
55 |
|
55 | |||
56 |
|
56 | |||
@@ -61,7 +61,7 b' def test_parse_path_ref(ref, default_pat' | |||||
61 | ]) |
|
61 | ]) | |
62 | def test_format_ref_id(alias, expected): |
|
62 | def test_format_ref_id(alias, expected): | |
63 | repo = mock.Mock(alias=alias) |
|
63 | repo = mock.Mock(alias=alias) | |
64 | format_ref_id = utils.get_format_ref_id(repo) |
|
64 | format_ref_id = view_utils.get_format_ref_id(repo) | |
65 | result = format_ref_id(name='name', raw_id='raw_id') |
|
65 | result = format_ref_id(name='name', raw_id='raw_id') | |
66 | assert result == expected |
|
66 | assert result == expected | |
67 |
|
67 | |||
@@ -77,7 +77,7 b' class TestGetCommit(object):' | |||||
77 | scm_instance.bookmarks = {ref_name: 'a_book_id'} |
|
77 | scm_instance.bookmarks = {ref_name: 'a_book_id'} | |
78 |
|
78 | |||
79 | scm_instance.get_commit.return_value = 'test' |
|
79 | scm_instance.get_commit.return_value = 'test' | |
80 | commit = utils.get_commit_from_ref_name(repo, ref_name, ref_type) |
|
80 | commit = view_utils.get_commit_from_ref_name(repo, ref_name, ref_type) | |
81 | scm_instance.get_commit.assert_called_once_with('a_%s_id' % ref_type) |
|
81 | scm_instance.get_commit.assert_called_once_with('a_%s_id' % ref_type) | |
82 | assert commit == 'test' |
|
82 | assert commit == 'test' | |
83 |
|
83 | |||
@@ -90,4 +90,4 b' class TestGetCommit(object):' | |||||
90 | repo.scm_instance().tags = {} |
|
90 | repo.scm_instance().tags = {} | |
91 | repo.scm_instance().bookmarks = {} |
|
91 | repo.scm_instance().bookmarks = {} | |
92 | with pytest.raises(RepositoryError): |
|
92 | with pytest.raises(RepositoryError): | |
93 | utils.get_commit_from_ref_name(repo, ref_name, ref_type) |
|
93 | view_utils.get_commit_from_ref_name(repo, ref_name, ref_type) |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now