Skip to content

Commit 85eb85d

Browse files
author
Joshua Cole
committed
Fixes py27 django 1.10 dep warnings in core subdomain urls.
Django 1.10 doesn't like using patterns('', ...) and instead wants the use of a list. It also no longer wants the string path to a callable and instead wants the callable itself.
1 parent e5652c1 commit 85eb85d

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

readthedocs/core/urls/subdomain.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,38 @@
44
from functools import reduce
55
from operator import add
66

7-
from django.conf.urls import url, patterns
7+
from django.conf.urls import url
88
from django.conf import settings
99
from django.conf.urls.static import static
1010

11+
from readthedocs.core.views.serve import (
12+
redirect_page_with_filename,
13+
redirect_project_slug,
14+
serve_docs
15+
)
16+
1117
from readthedocs.constants import pattern_opts
1218

1319
handler500 = 'readthedocs.core.views.server_error'
1420
handler404 = 'readthedocs.core.views.server_error_404'
1521

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

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

2732
url((r'^(?:|projects/(?P<subproject_slug>{project_slug})/)'
2833
r'(?P<lang_slug>{lang_slug})/'
2934
r'(?P<version_slug>{version_slug})/'
3035
r'(?P<filename>{filename_slug})$'.format(**pattern_opts)),
31-
'readthedocs.core.views.serve.serve_docs',
32-
name='docs_detail'),
33-
)
36+
serve_docs,
37+
name='docs_detail'),
38+
]
3439

3540
groups = [subdomain_urls]
3641

0 commit comments

Comments
 (0)