Changeset - 5a092b5f0d98
[Not reviewed]
default
0 2 0
Mads Kiilerich - 6 years ago 2019-11-11 01:56:23
mads@kiilerich.com
Grafted from: c618a2902db1
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'.
2 files changed with 6 insertions and 6 deletions:
0 comments (0 inline, 0 general)
kallithea/config/routing.py
Show inline comments
 
@@ -716,13 +716,13 @@ def make_map(config):
 
                 controller='files', action='raw', revision='tip', f_path='',
 
                 conditions=dict(function=check_repo))
 

	
 
    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:.*}',
 
                 controller='files', action='edit', revision='tip',
 
                 f_path='', conditions=dict(function=check_repo))
 

	
kallithea/tests/functional/test_files.py
Show inline comments
 
@@ -133,32 +133,32 @@ class TestFilesController(TestController
 
    def test_file_annotation(self):
 
        self.log_user()
 
        response = self.app.get(url(controller='files', action='index',
 
                                    repo_name=HG_REPO,
 
                                    revision='tip',
 
                                    f_path='vcs/nodes.py',
 
                                    annotate=True))
 
                                    annotate='1'))
 

	
 
        response.mustcontain("""r356:25213a5fbb04""")
 

	
 
    def test_file_annotation_git(self):
 
        self.log_user()
 
        response = self.app.get(url(controller='files', action='index',
 
                                    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):
 
        self.log_user()
 
        response = self.app.get(url(controller='files', action='history',
 
                                    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
 

	
 
    def test_file_annotation_history_git(self):
 
        self.log_user()
 
@@ -174,23 +174,23 @@ class TestFilesController(TestController
 
    def test_file_authors(self):
 
        self.log_user()
 
        response = self.app.get(url(controller='files', action='authors',
 
                                    repo_name=HG_REPO,
 
                                    revision='tip',
 
                                    f_path='vcs/nodes.py',
 
                                    annotate=True))
 
                                    annotate='1'))
 
        response.mustcontain('Marcin Kuzminski')
 
        response.mustcontain('Lukasz Balcerzak')
 

	
 
    def test_file_authors_git(self):
 
        self.log_user()
 
        response = self.app.get(url(controller='files', action='authors',
 
                                    repo_name=GIT_REPO,
 
                                    revision='master',
 
                                    f_path='vcs/nodes.py',
 
                                    annotate=True))
 
                                    annotate='1'))
 
        response.mustcontain('Marcin Kuzminski')
 
        response.mustcontain('Lukasz Balcerzak')
 

	
 
    def test_archival(self):
 
        self.log_user()
 
        _set_downloads(HG_REPO, set_to=True)
0 comments (0 inline, 0 general)