Unverified Commit 0255592c by Brian Mesick Committed by GitHub

Merge pull request #16436 from edx/bmedx/django111_urls_openedx

openedx urls cleanup for Django 1.11
parents 33335f7a 68e3894c
""" """
URL definitions for api access request API v1. URL definitions for api access request API v1.
""" """
from django.conf.urls import patterns, url from django.conf.urls import url
from openedx.core.djangoapps.api_admin.api.v1 import views from openedx.core.djangoapps.api_admin.api.v1 import views
urlpatterns = patterns( urlpatterns = [
'',
url(r'^api_access_request/$', views.ApiAccessRequestView.as_view(), name='list_api_access_request'), url(r'^api_access_request/$', views.ApiAccessRequestView.as_view(), name='list_api_access_request'),
) ]
...@@ -3,12 +3,11 @@ URL routes for the bookmarks app. ...@@ -3,12 +3,11 @@ URL routes for the bookmarks app.
""" """
from django.conf import settings from django.conf import settings
from django.conf.urls import patterns, url from django.conf.urls import url
from .views import BookmarksDetailView, BookmarksListView from .views import BookmarksDetailView, BookmarksListView
urlpatterns = patterns( urlpatterns = [
'bookmarks',
url( url(
r'^v1/bookmarks/$', r'^v1/bookmarks/$',
BookmarksListView.as_view(), BookmarksListView.as_view(),
...@@ -22,4 +21,4 @@ urlpatterns = patterns( ...@@ -22,4 +21,4 @@ urlpatterns = patterns(
BookmarksDetailView.as_view(), BookmarksDetailView.as_view(),
name='bookmarks_detail' name='bookmarks_detail'
), ),
) ]
""" """
URLs for the credit app. URLs for the credit app.
""" """
from django.conf.urls import include, patterns, url from django.conf.urls import include, url
from openedx.core.djangoapps.credit import models, routers, views from openedx.core.djangoapps.credit import models, routers, views
PROVIDER_ID_PATTERN = r'(?P<provider_id>{})'.format(models.CREDIT_PROVIDER_ID_REGEX) PROVIDER_ID_PATTERN = r'(?P<provider_id>{})'.format(models.CREDIT_PROVIDER_ID_REGEX)
PROVIDER_URLS = patterns( PROVIDER_URLS = [
'',
url(r'^request/$', views.CreditProviderRequestCreateView.as_view(), name='create_request'), url(r'^request/$', views.CreditProviderRequestCreateView.as_view(), name='create_request'),
url(r'^callback/?$', views.CreditProviderCallbackView.as_view(), name='provider_callback'), url(r'^callback/?$', views.CreditProviderCallbackView.as_view(), name='provider_callback'),
) ]
V1_URLS = patterns( V1_URLS = [
'',
url(r'^providers/{}/'.format(PROVIDER_ID_PATTERN), include(PROVIDER_URLS)), url(r'^providers/{}/'.format(PROVIDER_ID_PATTERN), include(PROVIDER_URLS)),
url(r'^eligibility/$', views.CreditEligibilityView.as_view(), name='eligibility_details'), url(r'^eligibility/$', views.CreditEligibilityView.as_view(), name='eligibility_details'),
) ]
router = routers.SimpleRouter() # pylint: disable=invalid-name router = routers.SimpleRouter() # pylint: disable=invalid-name
router.register(r'courses', views.CreditCourseViewSet) router.register(r'courses', views.CreditCourseViewSet)
router.register(r'providers', views.CreditProviderViewSet) router.register(r'providers', views.CreditProviderViewSet)
V1_URLS += router.urls V1_URLS += router.urls
urlpatterns = patterns( urlpatterns = [
'',
url(r'^v1/', include(V1_URLS)), url(r'^v1/', include(V1_URLS)),
) ]
...@@ -2,11 +2,10 @@ ...@@ -2,11 +2,10 @@
Contains all the URLs for the Dark Language Support App Contains all the URLs for the Dark Language Support App
""" """
from django.conf.urls import patterns, url from django.conf.urls import url
from openedx.core.djangoapps.dark_lang import views from openedx.core.djangoapps.dark_lang import views
urlpatterns = patterns( urlpatterns = [
'',
url(r'^$', views.PreviewLanguageFragmentView.as_view(), name='preview_lang'), url(r'^$', views.PreviewLanguageFragmentView.as_view(), name='preview_lang'),
) ]
"""URLs served by the embargo app. """ """URLs served by the embargo app. """
from django.conf.urls import patterns, url from django.conf.urls import url
from .views import CheckCourseAccessView, CourseAccessMessageView from .views import CheckCourseAccessView, CourseAccessMessageView
urlpatterns = patterns( urlpatterns = [
'openedx.core.djangoapps.embargo.views',
url( url(
r'^blocked-message/(?P<access_point>enrollment|courseware)/(?P<message_key>.+)/$', r'^blocked-message/(?P<access_point>enrollment|courseware)/(?P<message_key>.+)/$',
CourseAccessMessageView.as_view(), CourseAccessMessageView.as_view(),
name='blocked_message', name='blocked_message',
), ),
url(r'^v1/course_access/$', CheckCourseAccessView.as_view(), name='v1_course_access'), url(r'^v1/course_access/$', CheckCourseAccessView.as_view(), name='v1_course_access'),
) ]
""" """
Urls for verifying health (heartbeat) of the app. Urls for verifying health (heartbeat) of the app.
""" """
from django.conf.urls import patterns, url from django.conf.urls import url
urlpatterns = patterns( from openedx.core.djangoapps.heartbeat.views import heartbeat
'',
url(r'^$', 'openedx.core.djangoapps.heartbeat.views.heartbeat', name='heartbeat'), urlpatterns = [
) url(r'^$', heartbeat, name='heartbeat'),
]
...@@ -3,25 +3,24 @@ OAuth2 wrapper urls ...@@ -3,25 +3,24 @@ OAuth2 wrapper urls
""" """
from django.conf import settings from django.conf import settings
from django.conf.urls import patterns, url from django.conf.urls import url
from django.views.decorators.csrf import csrf_exempt from django.views.decorators.csrf import csrf_exempt
from . import views from . import views
urlpatterns = patterns( urlpatterns = [
'',
url(r'^authorize/?$', csrf_exempt(views.AuthorizationView.as_view()), name='authorize'), url(r'^authorize/?$', csrf_exempt(views.AuthorizationView.as_view()), name='authorize'),
url(r'^access_token/?$', csrf_exempt(views.AccessTokenView.as_view()), name='access_token'), url(r'^access_token/?$', csrf_exempt(views.AccessTokenView.as_view()), name='access_token'),
url(r'^revoke_token/?$', csrf_exempt(views.RevokeTokenView.as_view()), name='revoke_token'), url(r'^revoke_token/?$', csrf_exempt(views.RevokeTokenView.as_view()), name='revoke_token'),
url(r'^\.well-known/openid-configuration/?$', views.ProviderInfoView.as_view(), name='openid-config'), url(r'^\.well-known/openid-configuration/?$', views.ProviderInfoView.as_view(), name='openid-config'),
url(r'^jwks\.json$', views.JwksView.as_view(), name='jwks') url(r'^jwks\.json$', views.JwksView.as_view(), name='jwks')
) ]
if settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH'): if settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH'):
urlpatterns += ( urlpatterns += [
url( url(
r'^exchange_access_token/(?P<backend>[^/]+)/$', r'^exchange_access_token/(?P<backend>[^/]+)/$',
csrf_exempt(views.AccessTokenExchangeView.as_view()), csrf_exempt(views.AccessTokenExchangeView.as_view()),
name='exchange_access_token', name='exchange_access_token',
), ),
) ]
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
URLs for performance app URLs for performance app
""" """
from django.conf.urls import patterns, url from django.conf.urls import url
urlpatterns = patterns( from openedx.core.djangoapps.performance.views import performance_log
'openedx.core.djangoapps.performance.views',
url(r'^performance$', 'performance_log'), urlpatterns = [
) url(r'^performance$', performance_log),
]
...@@ -7,12 +7,11 @@ NOTE: These views are deprecated. These routes are superseded by ...@@ -7,12 +7,11 @@ NOTE: These views are deprecated. These routes are superseded by
""" """
from django.conf import settings from django.conf import settings
from django.conf.urls import patterns, url from django.conf.urls import url
from .views import ProfileImageRemoveView, ProfileImageUploadView from .views import ProfileImageRemoveView, ProfileImageUploadView
urlpatterns = patterns( urlpatterns = [
'',
url( url(
r'^v1/' + settings.USERNAME_PATTERN + '/upload$', r'^v1/' + settings.USERNAME_PATTERN + '/upload$',
ProfileImageUploadView.as_view(), ProfileImageUploadView.as_view(),
...@@ -23,4 +22,4 @@ urlpatterns = patterns( ...@@ -23,4 +22,4 @@ urlpatterns = patterns(
ProfileImageRemoveView.as_view(), ProfileImageRemoveView.as_view(),
name="profile_image_remove" name="profile_image_remove"
), ),
) ]
...@@ -2,13 +2,12 @@ ...@@ -2,13 +2,12 @@
Django URLs for service status app Django URLs for service status app
""" """
from django.conf.urls import patterns, url from django.conf.urls import url
urlpatterns = patterns( from openedx.core.djangoapps.service_status.views import index, celery_status, celery_ping
'',
url(r'^$', 'openedx.core.djangoapps.service_status.views.index', name='status.service.index'), urlpatterns = [
url(r'^celery/$', 'openedx.core.djangoapps.service_status.views.celery_status', url(r'^$', index, name='status.service.index'),
name='status.service.celery.status'), url(r'^celery/$', celery_status, name='status.service.celery.status'),
url(r'^celery/ping/$', 'openedx.core.djangoapps.service_status.views.celery_ping', url(r'^celery/ping/$', celery_ping, name='status.service.celery.ping'),
name='status.service.celery.ping'), ]
)
...@@ -3,7 +3,7 @@ Defines the URL routes for this app. ...@@ -3,7 +3,7 @@ Defines the URL routes for this app.
""" """
from django.conf import settings from django.conf import settings
from django.conf.urls import include, patterns, url from django.conf.urls import include, url
from rest_framework import routers from rest_framework import routers
from . import views as user_api_views from . import views as user_api_views
...@@ -12,8 +12,8 @@ from .models import UserPreference ...@@ -12,8 +12,8 @@ from .models import UserPreference
USER_API_ROUTER = routers.DefaultRouter() USER_API_ROUTER = routers.DefaultRouter()
USER_API_ROUTER.register(r'users', user_api_views.UserViewSet) USER_API_ROUTER.register(r'users', user_api_views.UserViewSet)
USER_API_ROUTER.register(r'user_prefs', user_api_views.UserPreferenceViewSet) USER_API_ROUTER.register(r'user_prefs', user_api_views.UserPreferenceViewSet)
urlpatterns = patterns(
'', urlpatterns = [
url(r'^v1/', include(USER_API_ROUTER.urls)), url(r'^v1/', include(USER_API_ROUTER.urls)),
url( url(
r'^v1/preferences/(?P<pref_key>{})/users/$'.format(UserPreference.KEY_REGEX), r'^v1/preferences/(?P<pref_key>{})/users/$'.format(UserPreference.KEY_REGEX),
...@@ -33,15 +33,14 @@ urlpatterns = patterns( ...@@ -33,15 +33,14 @@ urlpatterns = patterns(
r'^v1/preferences/time_zones/$', r'^v1/preferences/time_zones/$',
user_api_views.CountryTimeZoneListView.as_view(), user_api_views.CountryTimeZoneListView.as_view(),
), ),
) ]
if settings.FEATURES.get('ENABLE_COMBINED_LOGIN_REGISTRATION'): if settings.FEATURES.get('ENABLE_COMBINED_LOGIN_REGISTRATION'):
urlpatterns += patterns( urlpatterns += [
'',
url(r'^v1/account/login_session/$', user_api_views.LoginSessionView.as_view(), url(r'^v1/account/login_session/$', user_api_views.LoginSessionView.as_view(),
name="user_api_login_session"), name="user_api_login_session"),
url(r'^v1/account/registration/$', user_api_views.RegistrationView.as_view(), url(r'^v1/account/registration/$', user_api_views.RegistrationView.as_view(),
name="user_api_registration"), name="user_api_registration"),
url(r'^v1/account/password_reset/$', user_api_views.PasswordResetView.as_view(), url(r'^v1/account/password_reset/$', user_api_views.PasswordResetView.as_view(),
name="user_api_password_reset"), name="user_api_password_reset"),
) ]
...@@ -3,7 +3,7 @@ Defines the URL routes for this app. ...@@ -3,7 +3,7 @@ Defines the URL routes for this app.
""" """
from django.conf import settings from django.conf import settings
from django.conf.urls import patterns, url from django.conf.urls import url
from ..profile_images.views import ProfileImageView from ..profile_images.views import ProfileImageView
from .accounts.views import AccountDeactivationView, AccountViewSet from .accounts.views import AccountDeactivationView, AccountViewSet
...@@ -24,8 +24,7 @@ ACCOUNT_DETAIL = AccountViewSet.as_view({ ...@@ -24,8 +24,7 @@ ACCOUNT_DETAIL = AccountViewSet.as_view({
'patch': 'partial_update', 'patch': 'partial_update',
}) })
urlpatterns = patterns( urlpatterns = [
'',
url( url(
r'^v1/me$', r'^v1/me$',
ME, ME,
...@@ -71,4 +70,4 @@ urlpatterns = patterns( ...@@ -71,4 +70,4 @@ urlpatterns = patterns(
PreferencesDetailView.as_view(), PreferencesDetailView.as_view(),
name='preferences_detail_api' name='preferences_detail_api'
), ),
) ]
...@@ -12,7 +12,7 @@ from collections import namedtuple ...@@ -12,7 +12,7 @@ from collections import namedtuple
import ddt import ddt
from datetime import datetime, timedelta from datetime import datetime, timedelta
from django.conf import settings from django.conf import settings
from django.conf.urls import patterns, url, include from django.conf.urls import url, include
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.http import HttpResponse from django.http import HttpResponse
from django.test import TestCase from django.test import TestCase
...@@ -54,8 +54,7 @@ class OAuth2AuthenticationDebug(authentication.OAuth2AuthenticationAllowInactive ...@@ -54,8 +54,7 @@ class OAuth2AuthenticationDebug(authentication.OAuth2AuthenticationAllowInactive
allow_query_params_token = True allow_query_params_token = True
urlpatterns = patterns( urlpatterns = [
'',
url(r'^oauth2/', include('provider.oauth2.urls', namespace='oauth2')), url(r'^oauth2/', include('provider.oauth2.urls', namespace='oauth2')),
url( url(
r'^oauth2-test/$', r'^oauth2-test/$',
...@@ -69,7 +68,7 @@ urlpatterns = patterns( ...@@ -69,7 +68,7 @@ urlpatterns = patterns(
permission_classes=[permissions.TokenHasReadWriteScope] permission_classes=[permissions.TokenHasReadWriteScope]
) )
), ),
) ]
@attr(shard=2) @attr(shard=2)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment