Skip to content

Commit

Permalink
Avoid importing django.conf.urls.defaults on django 1.4+
Browse files Browse the repository at this point in the history
  • Loading branch information
charettes committed Dec 30, 2012
1 parent 22ebebd commit 39088e7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion debug_toolbar/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
These should not be loaded explicitly; the debug toolbar middleware will patch
this into the urlconf for the request.
"""
from django.conf.urls.defaults import *
try:
from django.conf.urls import patterns, url
except ImportError: # django < 1.4
from django.conf.urls.defaults import patterns, url

_PREFIX = '__debug__'

Expand Down
7 changes: 5 additions & 2 deletions tests/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@
These should not be loaded explicitly; the debug toolbar middleware will patch
this into the urlconf for the request.
"""
from django.conf.urls.defaults import *
from django.contrib import admin
try:
from django.conf.urls import patterns, url
except ImportError: # django < 1.4
from django.conf.urls.defaults import patterns, url

admin.autodiscover()

urlpatterns = patterns('',
# This pattern should be last to ensure tests still work
url(r'^resolving1/(.+)/(.+)/$', 'tests.views.resolving_view', name = 'positional-resolving'),
url(r'^resolving1/(.+)/(.+)/$', 'tests.views.resolving_view', name='positional-resolving'),
url(r'^resolving2/(?P<arg1>.+)/(?P<arg2>.+)/$', 'tests.views.resolving_view'),
url(r'^resolving3/(.+)/$', 'tests.views.resolving_view', { 'arg2' : 'default' }),
url(r'^execute_sql/$', 'tests.views.execute_sql'),
Expand Down

1 comment on commit 39088e7

@oliveagle
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1
there are others too

DeprecationWarning: django.utils.hashcompat is deprecated; use hashlib instead
PendingDeprecationWarning: django.utils.simplejson is deprecated; use json instead.

Please sign in to comment.