Skip to content

Commit 9161967

Browse files
committed
Rename function to make it clearer
1 parent 88f58bf commit 9161967

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

readthedocs/projects/tasks/search.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from readthedocs.builds.models import Build, Version
77
from readthedocs.projects.models import HTMLFile, Project
88
from readthedocs.projects.signals import files_changed
9-
from readthedocs.proxito.views.utils import allow_readme_html_at_root_url
9+
from readthedocs.proxito.views.utils import allow_readme_html_as_index
1010
from readthedocs.search.documents import PageDocument
1111
from readthedocs.search.utils import index_objects, remove_indexed_files
1212
from readthedocs.storage import build_media_storage
@@ -204,7 +204,7 @@ def _create_imported_files_and_search_index(
204204

205205
# Create the imported file only if it's a top-level 404 file,
206206
# or if it's an index file. We don't need to keep track of all files.
207-
if allow_readme_html_at_root_url():
207+
if allow_readme_html_as_index():
208208
tryfiles = ["index.html", "README.html"]
209209
else:
210210
tryfiles = ["index.html"]

readthedocs/proxito/views/serve.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
ServeRedirectMixin,
4242
StorageFileNotFound,
4343
)
44-
from readthedocs.proxito.views.utils import allow_readme_html_at_root_url
44+
from readthedocs.proxito.views.utils import allow_readme_html_as_index
4545
from readthedocs.redirects.exceptions import InfiniteRedirectException
4646
from readthedocs.storage import build_media_storage
4747

@@ -643,7 +643,7 @@ def _get_index_file_redirect(self, request, project, version, filename, full_pat
643643
- /en/latest/foo/ -> /en/latest/foo/README.html
644644
"""
645645

646-
if allow_readme_html_at_root_url():
646+
if allow_readme_html_as_index():
647647
tryfiles = ["index.html", "README.html"]
648648
# If the path ends with `/`, we already tried to serve
649649
# the `/index.html` file, so we only need to test for
@@ -669,7 +669,7 @@ def _get_index_file_redirect(self, request, project, version, filename, full_pat
669669
log.info("Redirecting to index file.", tryfile=tryfile)
670670
# Use urlparse so that we maintain GET args in our redirect
671671
parts = urlparse(full_path)
672-
if allow_readme_html_at_root_url() and tryfile.endswith("README.html"):
672+
if allow_readme_html_as_index() and tryfile.endswith("README.html"):
673673
new_path = parts.path.rstrip("/") + "/README.html"
674674
else:
675675
new_path = parts.path.rstrip("/") + "/"

readthedocs/proxito/views/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def proxito_404_page_handler(
6262
return r
6363

6464

65-
def allow_readme_html_at_root_url():
65+
def allow_readme_html_as_index():
6666
tzinfo = pytz.timezone("America/Los_Angeles")
6767
now = datetime.datetime.now(tz=tzinfo)
6868

0 commit comments

Comments
 (0)