Skip to content

Commit 54c51b0

Browse files
committed
urlpatterns are now plain lists
1 parent a23b11e commit 54c51b0

File tree

9 files changed

+23
-26
lines changed

9 files changed

+23
-26
lines changed

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ Notice that `oauth2_provider` namespace is mandatory.
7272

7373
.. code-block:: python
7474
75-
urlpatterns = patterns(
75+
urlpatterns = [
7676
...
7777
url(r'^o/', include('oauth2_provider.urls', namespace='oauth2_provider')),
78-
)
78+
]
7979
8080
Documentation
8181
--------------

docs/install.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ If you need an OAuth2 provider you'll want to add the following to your urls.py
1919

2020
.. code-block:: python
2121
22-
urlpatterns = patterns(
22+
urlpatterns = [
2323
...
2424
url(r'^o/', include('oauth2_provider.urls', namespace='oauth2_provider')),
25-
)
25+
]
2626
2727
Sync your database
2828
------------------

docs/rest-framework/getting_started.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Here's our project's root `urls.py` module:
4848

4949
.. code-block:: python
5050
51-
from django.conf.urls import url, patterns, include
51+
from django.conf.urls import url, include
5252
from django.contrib.auth.models import User, Group
5353
from django.contrib import admin
5454
admin.autodiscover()
@@ -91,11 +91,11 @@ Here's our project's root `urls.py` module:
9191
9292
# Wire up our API using automatic URL routing.
9393
# Additionally, we include login URLs for the browseable API.
94-
urlpatterns = patterns('',
94+
urlpatterns = [
9595
url(r'^', include(router.urls)),
9696
url(r'^o/', include('oauth2_provider.urls', namespace='oauth2_provider')),
9797
url(r'^admin/', include(admin.site.urls)),
98-
)
98+
]
9999
100100
Also add the following to your `settings.py` module:
101101

docs/tutorial/tutorial_01.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,11 @@ Include the Django OAuth Toolkit urls in your `urls.py`, choosing the urlspace y
3333

3434
.. code-block:: python
3535
36-
urlpatterns = patterns(
37-
'',
36+
urlpatterns = [
3837
url(r'^admin/', include(admin.site.urls)),
3938
url(r'^o/', include('oauth2_provider.urls', namespace='oauth2_provider')),
4039
# ...
41-
)
40+
]
4241
4342
Include the CORS middleware in your `settings.py`:
4443

docs/tutorial/tutorial_02.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ URL this view will respond to:
3434

3535
.. code-block:: python
3636
37-
from django.conf.urls import patterns, url
37+
from django.conf.urls import url
3838
import oauth2_provider.views as oauth2_views
3939
from django.conf import settings
4040
from .views import ApiEndpoint

docs/tutorial/tutorial_03.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,10 @@ To check everything works properly, mount the view above to some url:
6565

6666
.. code-block:: python
6767
68-
urlpatterns = patterns(
69-
'',
68+
urlpatterns = [
7069
url(r'^secret$', 'my.views.secret_page', name='secret'),
7170
'...',
72-
)
71+
]
7372
7473
You should have an :term:`Application` registered at this point, if you don't, follow the steps in
7574
the previous tutorials to create one. Obtain an :term:`Access Token`, either following the OAuth2

oauth2_provider/tests/test_rest_framework.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import unittest
22
from datetime import timedelta
33

4-
from django.conf.urls import patterns, url, include
4+
from django.conf.urls import url, include
55
from django.contrib.auth import get_user_model
66
from django.http import HttpResponse
77
from django.test import TestCase
@@ -50,15 +50,14 @@ class ResourceScopedView(OAuth2View):
5050
permission_classes = [permissions.IsAuthenticated, TokenHasResourceScope]
5151
required_scopes = ['resource1']
5252

53-
urlpatterns = patterns(
54-
'',
53+
urlpatterns = [
5554
url(r'^oauth2/', include('oauth2_provider.urls')),
5655
url(r'^oauth2-test/$', OAuth2View.as_view()),
5756
url(r'^oauth2-scoped-test/$', ScopedView.as_view()),
5857
url(r'^oauth2-read-write-test/$', ReadWriteScopedView.as_view()),
5958
url(r'^oauth2-resource-scoped-test/$', ResourceScopedView.as_view()),
6059
url(r'^oauth2-authenticated-or-scoped-test/$', AuthenticatedOrScopedView.as_view()),
61-
)
60+
]
6261

6362
rest_framework_installed = True
6463
except ImportError:

oauth2_provider/tests/urls.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
admin.autodiscover()
55

66

7-
urlpatterns = (
7+
urlpatterns = [
88
url(r'^admin/', include(admin.site.urls)),
99
url(r'^o/', include('oauth2_provider.urls', namespace='oauth2_provider')),
10-
)
10+
]

oauth2_provider/urls.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@
33

44
from . import views
55

6-
urlpatterns = (
6+
urlpatterns = [
77
url(r'^authorize/$', views.AuthorizationView.as_view(), name="authorize"),
88
url(r'^token/$', views.TokenView.as_view(), name="token"),
99
url(r'^revoke_token/$', views.RevokeTokenView.as_view(), name="revoke-token"),
10-
)
10+
]
1111

1212
# Application management views
13-
urlpatterns += (
13+
urlpatterns += [
1414
url(r'^applications/$', views.ApplicationList.as_view(), name="list"),
1515
url(r'^applications/register/$', views.ApplicationRegistration.as_view(), name="register"),
1616
url(r'^applications/(?P<pk>\d+)/$', views.ApplicationDetail.as_view(), name="detail"),
1717
url(r'^applications/(?P<pk>\d+)/delete/$', views.ApplicationDelete.as_view(), name="delete"),
1818
url(r'^applications/(?P<pk>\d+)/update/$', views.ApplicationUpdate.as_view(), name="update"),
19-
)
19+
]
2020

21-
urlpatterns += (
21+
urlpatterns += [
2222
url(r'^authorized_tokens/$', views.AuthorizedTokensListView.as_view(), name="authorized-token-list"),
2323
url(r'^authorized_tokens/(?P<pk>\d+)/delete/$', views.AuthorizedTokenDeleteView.as_view(),
2424
name="authorized-token-delete"),
25-
)
25+
]

0 commit comments

Comments
 (0)