Skip to content

Commit

Permalink
Import serve_docs from Corporate
Browse files Browse the repository at this point in the history
Use the serve_docs from Corporate as a HACK and do nothing extra if it
fails for any reason
  • Loading branch information
humitos committed Jun 13, 2019
1 parent 058e2db commit f43ece3
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions readthedocs/core/views/serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,21 @@ def redirect_project_slug(request, project, subproject): # pylint: disable=unus
# ``subproject`` is a single-version, we don't have to redirect but to serve
# the index file instead.
if subproject and subproject.single_version:
# TODO: find a way to import ``serve_docs`` from corporate
return serve_docs(request, project, project.slug, subproject, subproject.slug)
try:
# HACK: this only affects corporate site and won't be hit on the
# community. This can be removed once the middleware incorporates
# more data or redirects happen outside this application
# See: https://github.com/rtfd/readthedocs.org/pull/5690
from readthedocsinc.core.views import serve_docs as corporate_serve_docs
return corporate_serve_docs(request, project, project.slug, subproject, subproject.slug)
except Exception:
pass

return HttpResponseRedirect(
resolve(
subproject or project,
query_params=urlparse_result.query,
)
),
)


Expand Down

0 comments on commit f43ece3

Please sign in to comment.