Skip to content

Commit f43ece3

Browse files
committed
Import serve_docs from Corporate
Use the serve_docs from Corporate as a HACK and do nothing extra if it fails for any reason
1 parent 058e2db commit f43ece3

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

readthedocs/core/views/serve.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,21 @@ def redirect_project_slug(request, project, subproject): # pylint: disable=unus
115115
# ``subproject`` is a single-version, we don't have to redirect but to serve
116116
# the index file instead.
117117
if subproject and subproject.single_version:
118-
# TODO: find a way to import ``serve_docs`` from corporate
119-
return serve_docs(request, project, project.slug, subproject, subproject.slug)
118+
try:
119+
# HACK: this only affects corporate site and won't be hit on the
120+
# community. This can be removed once the middleware incorporates
121+
# more data or redirects happen outside this application
122+
# See: https://github.com/rtfd/readthedocs.org/pull/5690
123+
from readthedocsinc.core.views import serve_docs as corporate_serve_docs
124+
return corporate_serve_docs(request, project, project.slug, subproject, subproject.slug)
125+
except Exception:
126+
pass
120127

121128
return HttpResponseRedirect(
122129
resolve(
123130
subproject or project,
124131
query_params=urlparse_result.query,
125-
)
132+
),
126133
)
127134

128135

0 commit comments

Comments
 (0)