Ariana Giroux
unread,May 31, 2020, 8:38:31 PM5/31/20Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to klaus...@googlegroups.com, ariana...@gmail.com
- Adds a new environment variable for expanding the list of known readme
filenames. Now, the user can set 'KLAUS_README_FILENAMES' to a space
separated list of filenames to add to the search space.
- Also enforces strict PEP8 adherance in klaus.views.
---
klaus/views.py | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/klaus/views.py b/klaus/views.py
index 6fafdd1..73c5e63 100644
--- a/klaus/views.py
+++ b/klaus/views.py
@@ -13,6 +13,7 @@ import dulwich.archive
import dulwich.config
from dulwich.object_store import tree_lookup_path
+
try:
import ctags
except ImportError:
@@ -29,6 +30,16 @@ from klaus.utils import parent_directory, subpaths, force_unicode, guess_is_bina
README_FILENAMES = [b'README', b'README.md', b'README.mkdn', b'README.mdwn', b'README.markdown', b'README.rst']
+# If 'KLAUS_README_FILENAMES' is defined on the command line, then we can
+# attempt to append the provided data to our list of filenames.
+# For example:
+#
+# $ export KLAUS_README_FILENAMES='readme.rst readme.md readme.txt'
+#
+# Will add b'readme.rst', b'readme.md', and b'readme.txt' to the list.
+if list(os.environb).count(b'KLAUS_README_FILENAMES'):
+ README_FILENAMES += os.environb[b'KLAUS_README_FILENAMES'].split()
+
def repo_list():
"""Show a list of all repos and can be sorted by last update."""
@@ -44,7 +55,6 @@ def repo_list():
order_by=order_by, base_href=None)
-
def robots_txt():
"""Serve the robots.txt file to manage the indexing of the site by search engines."""
return current_app.send_static_file('robots.txt')
@@ -280,7 +290,7 @@ class IndexView(TreeViewMixin, BaseRepoView):
'rendered_code': None,
})
else:
- readme_filename = force_unicode(readme_filename)
+ readme_filename = force_unicode(readme_filename)
readme_data = force_unicode(readme_data)
self.context.update({
'is_markup': markup.can_render(readme_filename),
--
2.17.1