From d4ed15be757b76d32755f32d70332e594bbb39cc Mon Sep 17 00:00:00 2001 From: rahul Bajaj Date: Jan 09 2017 12:51:32 +0000 Subject: Provide link for pagure documentation Apparently, the end user being new to pagure is unable to configure his/her project documentation and does not know where to look for it. This patch provides a link that directs the user to pagure documentation that shall help the users to configure thier projects documents. Fixes: https://pagure.io/pagure/issue/1562 --- diff --git a/pagure/docs_server.py b/pagure/docs_server.py index 172028d..eb2f7bf 100644 --- a/pagure/docs_server.py +++ b/pagure/docs_server.py @@ -139,7 +139,10 @@ def view_docs(repo, username=None, filename=None): if not repo_obj.is_empty: commit = repo_obj[repo_obj.head.target] else: - flask.abort(404, 'No content found is the repository') + flask.abort(404, 'No content found in the repository, ' + 'you may want to read the ' + '' + 'Using the doc repository of your project documentation.') branchname = 'master' content = None @@ -169,7 +172,10 @@ def view_docs(repo, username=None, filename=None): if not content: if not tree or not len(tree): - flask.abort(404, 'No content found is the repository') + flask.abort(404, 'No content found in the repository, ' + 'you may want to read the ' + '' + 'Using the doc repository of your project documentation.') html = '
  • ' for el in tree: name = el.name diff --git a/tests/test_pagure_flask_docs.py b/tests/test_pagure_flask_docs.py index a954aec..162bd57 100644 --- a/tests/test_pagure_flask_docs.py +++ b/tests/test_pagure_flask_docs.py @@ -163,6 +163,13 @@ class PagureFlaskDocstests(tests.Modeltests): output = self.app.get('/test/docs') self.assertEqual(output.status_code, 404) + self.assertIn( + '

    No content found in the repository, ' + 'you may want to read the ' + '' + 'Using the doc repository of your project documentation.

    ', + output.data + ) output = self.app.get('/test/sources') self.assertEqual(output.status_code, 200)