#1719 Provide link for pagure documentation
Closed 7 years ago by pingou. Opened 7 years ago by rahulbajaj.
rahulbajaj/pagure DocGuide  into  master

file modified
+8 -2
@@ -139,7 +139,10 @@ 

      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 '

+                          '<a href="https://docs.pagure.org/pagure/usage/using_doc.html">'

+                          'Using the doc repository of your project</a> documentation.')

      branchname = 'master'

  

      content = None
@@ -169,7 +172,10 @@ 

  

      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 '

+                              '<a href="https://docs.pagure.org/pagure/usage/using_doc.html">'

+                              'Using the doc repository of your project</a> documentation.')

          html = '<li>'

          for el in tree:

              name = el.name

@@ -163,6 +163,13 @@ 

  

          output = self.app.get('/test/docs')

          self.assertEqual(output.status_code, 404)

+         self.assertIn(

+             '<p>No content found in the repository, '

+             'you may want to read the '

+             '<a href="https://docs.pagure.org/pagure/usage/using_doc.html">'

+             'Using the doc repository of your project</a> documentation.</p>',

+             output.data

+         )

  

          output = self.app.get('/test/sources')

          self.assertEqual(output.status_code, 200)

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

Two small remarks:

a) Could you make the lines shorter?
b) Since you are within () there is no need for the \. You can simply do:

flask.abort(404, 'No content found in the repository, '
                  'to know more about the documentation please visit '
                  '<a href="....">....</a>'
)

Or something like this :)

Another thing we could do is adding a small test for this feature, maybe something like:

diff --git a/ tests/test_pagure_flask_docs.py b/ tests/test_pagure_flask_docs.py
index a954aec..a6a2a42 100644
--- a/tests/test_pagure_flask_docs.py  
+++ b/tests/test_pagure_flask_docs.py  
@@ -163,6 +163,12 @@ class PagureFlaskDocstests(tests.Modeltests):

         output = self.app.get('/test/docs')
         self.assertEqual(output.status_code, 404)
+        self.assertIn(
+            '<p>No content found in the repository, to know more about the '
+            'documentation please visit '
+            'https://docs.pagure.org/pagure/usage/using_doc.html</p>',
+            output.data
+        )

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

To adjust based on the change you make :)

rebased

7 years ago

Yup, feel free to rebase while I test it locally :)

Did you test it, yourself?

Did you test it, yourself?

Not actually. When i had 'git grep "No content found in the repository" ' , i just found the string and thought of replacing it with a better one.

Then I would encourage you to test your change and see how it looks :)

Any progress on this one?

@pingou previously I was having a little issue reproducing the bug but now I am able to.

Figuring out a way to add a link in the flask.abort() !

Any news on this? Need some help?

We were looking on how to do this and @charcol just gave us a great example in https://pagure.io/pagure/pull-request/1998 :)

Ah! thats awesome ! Let me try it :)

@rahulbajaj there has not been any updates from you on this PR since March 3rd, so I will close it and will open one addressing this ticket.

Thanks for starting the work on this!

Pull-Request has been closed by pingou

7 years ago