# HG changeset patch # User Mads Kiilerich # Date 2019-11-11 01:56:23 # Node ID 5a092b5f0d98f0fd833983165550c00f3ad0649e # Parent db8531aabfdc21f1819ecfc8f785b628fb65eaec routing: fix files_annotate_home annotate value to be compatible with Routes >= 2 The routing entry for files_annotate_home had annotate=True. That primarily served to let the controller files.index differentiate files_annotate_home from files_home and files_home_nopath . Anything true can work. test_files.py is creating files_annotate_home URLs in an odd way: Instead of explicitly specifying it is a files_annotate_home URL, it passes expected controller parameters and expects routing to find a URL that would provide these parameters. It thus also has to specify the otherwise "invisible" annotate value. For Routes < 2, True works just fine. For Routes >= 2, it seems to expect values that actually can be encoded in URLs. Thus, instead of True, use '1'. diff --git a/kallithea/config/routing.py b/kallithea/config/routing.py --- a/kallithea/config/routing.py +++ b/kallithea/config/routing.py @@ -719,7 +719,7 @@ def make_map(config): rmap.connect('files_annotate_home', '/{repo_name:.*?}/annotate/{revision}/{f_path:.*}', controller='files', revision='tip', - f_path='', annotate=True, conditions=dict(function=check_repo)) + f_path='', annotate='1', conditions=dict(function=check_repo)) rmap.connect('files_edit_home', '/{repo_name:.*?}/edit/{revision}/{f_path:.*}', diff --git a/kallithea/tests/functional/test_files.py b/kallithea/tests/functional/test_files.py --- a/kallithea/tests/functional/test_files.py +++ b/kallithea/tests/functional/test_files.py @@ -136,7 +136,7 @@ class TestFilesController(TestController repo_name=HG_REPO, revision='tip', f_path='vcs/nodes.py', - annotate=True)) + annotate='1')) response.mustcontain("""r356:25213a5fbb04""") @@ -146,7 +146,7 @@ class TestFilesController(TestController repo_name=GIT_REPO, revision='master', f_path='vcs/nodes.py', - annotate=True)) + annotate='1')) response.mustcontain("""r345:c994f0de03b2""") def test_file_annotation_history(self): @@ -155,7 +155,7 @@ class TestFilesController(TestController repo_name=HG_REPO, revision='tip', f_path='vcs/nodes.py', - annotate=True), + annotate='1'), extra_environ={'HTTP_X_PARTIAL_XHR': '1'}) assert response.body == HG_NODE_HISTORY @@ -177,7 +177,7 @@ class TestFilesController(TestController repo_name=HG_REPO, revision='tip', f_path='vcs/nodes.py', - annotate=True)) + annotate='1')) response.mustcontain('Marcin Kuzminski') response.mustcontain('Lukasz Balcerzak') @@ -187,7 +187,7 @@ class TestFilesController(TestController repo_name=GIT_REPO, revision='master', f_path='vcs/nodes.py', - annotate=True)) + annotate='1')) response.mustcontain('Marcin Kuzminski') response.mustcontain('Lukasz Balcerzak')