changeset 7992:5a092b5f0d98

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'.
author Mads Kiilerich <mads@kiilerich.com>
date Mon, 11 Nov 2019 01:56:23 +0100
parents db8531aabfdc
children a99b7e388979
files kallithea/config/routing.py kallithea/tests/functional/test_files.py
diffstat 2 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/config/routing.py	Sun Dec 01 21:02:43 2019 +0100
+++ b/kallithea/config/routing.py	Mon Nov 11 01:56:23 2019 +0100
@@ -719,7 +719,7 @@
     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:.*}',
--- a/kallithea/tests/functional/test_files.py	Sun Dec 01 21:02:43 2019 +0100
+++ b/kallithea/tests/functional/test_files.py	Mon Nov 11 01:56:23 2019 +0100
@@ -136,7 +136,7 @@
                                     repo_name=HG_REPO,
                                     revision='tip',
                                     f_path='vcs/nodes.py',
-                                    annotate=True))
+                                    annotate='1'))
 
         response.mustcontain("""r356:25213a5fbb04""")
 
@@ -146,7 +146,7 @@
                                     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 @@
                                     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 @@
                                     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 @@
                                     repo_name=GIT_REPO,
                                     revision='master',
                                     f_path='vcs/nodes.py',
-                                    annotate=True))
+                                    annotate='1'))
         response.mustcontain('Marcin Kuzminski')
         response.mustcontain('Lukasz Balcerzak')