Skip to content

Fixes py27 django 1.10 dep warnings in core subdomain urls. #3047

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions readthedocs/core/urls/subdomain.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,40 @@
from functools import reduce
from operator import add

from django.conf.urls import url, patterns
from django.conf.urls import url
from django.conf import settings
from django.conf.urls.static import static

from readthedocs.core.views.serve import (
redirect_page_with_filename,
redirect_project_slug, serve_docs
)
from readthedocs.core.views import (
server_error_500,
server_error_404,
)
from readthedocs.constants import pattern_opts

handler500 = 'readthedocs.core.views.server_error'
handler404 = 'readthedocs.core.views.server_error_404'
handler500 = server_error_500
handler404 = server_error_404

subdomain_urls = patterns(
'', # base view, flake8 complains if it is on the previous line.
subdomain_urls = [
url(r'^(?:|projects/(?P<subproject_slug>{project_slug})/)'
r'page/(?P<filename>.*)$'.format(**pattern_opts),
'readthedocs.core.views.serve.redirect_page_with_filename',
redirect_page_with_filename,
name='docs_detail'),

url((r'^(?:|projects/(?P<subproject_slug>{project_slug})/)$').format(**pattern_opts),
'readthedocs.core.views.serve.redirect_project_slug',
redirect_project_slug,
name='redirect_project_slug'),

url((r'^(?:|projects/(?P<subproject_slug>{project_slug})/)'
r'(?P<lang_slug>{lang_slug})/'
r'(?P<version_slug>{version_slug})/'
r'(?P<filename>{filename_slug})$'.format(**pattern_opts)),
'readthedocs.core.views.serve.serve_docs',
serve_docs,
name='docs_detail'),
)
]

groups = [subdomain_urls]

Expand Down
7 changes: 4 additions & 3 deletions readthedocs/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
from readthedocs.api.base import (ProjectResource, UserResource,
VersionResource, FileResource)
from readthedocs.core.urls import docs_urls, core_urls, deprecated_urls
from readthedocs.core.views import HomepageView, SupportView
from readthedocs.core.views import (HomepageView, SupportView,
server_error_404, server_error_500)
from readthedocs.search import views as search_views


Expand All @@ -26,8 +27,8 @@

admin.autodiscover()

handler404 = 'readthedocs.core.views.server_error_404'
handler500 = 'readthedocs.core.views.server_error_500'
handler404 = server_error_404
handler500 = server_error_500

basic_urls = [
url(r'^$', HomepageView.as_view(), name='homepage'),
Expand Down