Update URLs to Django 1.8+ style

Django 1.8 altered and deprecated the existing pattern for defining
URLs. This will be removed in 1.10, meaning that many deprecation
warnings show up under Django 1.9. We should fix the URLs promptly to
avoid logspam, and to support Django 1.10 in Newton.

See
https://docs.djangoproject.com/en/1.9/releases/1.8/#django-conf-urls-patterns

Change-Id: Ieea8e1058c833be07c57e5949d4c5f614359a1ea
Partially-Implements: blueprint dj110
This commit is contained in:
Rob Cresswell 2016-02-15 15:55:51 +00:00
parent 34478aa88b
commit d3bca7a8fb
2 changed files with 14 additions and 17 deletions

View File

@ -12,19 +12,18 @@
# limitations under the License.
from django.conf.urls import include
from django.conf.urls import patterns
from django.conf.urls import url
from django.views import generic
from openstack_auth import utils
from openstack_auth import views
utils.patch_middleware_get_user()
urlpatterns = patterns(
'',
urlpatterns = [
url(r"", include('openstack_auth.urls')),
url(r"^websso/$", "openstack_auth.views.websso", name='websso'),
url(r"^websso/$", views.websso, name='websso'),
url(r"^$", generic.TemplateView.as_view(template_name="auth/blank.html"))
)
]

View File

@ -11,25 +11,23 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from django.conf.urls import patterns
from django.conf.urls import url
from openstack_auth import utils
from openstack_auth import views
utils.patch_middleware_get_user()
urlpatterns = patterns(
'openstack_auth.views',
url(r"^login/$", "login", name='login'),
url(r"^logout/$", 'logout', name='logout'),
url(r'^switch/(?P<tenant_id>[^/]+)/$', 'switch', name='switch_tenants'),
url(r'^switch_services_region/(?P<region_name>[^/]+)/$', 'switch_region',
urlpatterns = [
url(r"^login/$", views.login, name='login'),
url(r"^logout/$", views.logout, name='logout'),
url(r'^switch/(?P<tenant_id>[^/]+)/$', views.switch,
name='switch_tenants'),
url(r'^switch_services_region/(?P<region_name>[^/]+)/$',
views.switch_region,
name='switch_services_region')
)
]
if utils.is_websso_enabled():
urlpatterns += patterns(
'openstack_auth.views',
url(r"^websso/$", "websso", name='websso')
)
urlpatterns.append(url(r"^websso/$", views.websso, name='websso'))