Skip to content

Commit

Permalink
Merge pull request getsentry#1027 from felixxm/django-2.0
Browse files Browse the repository at this point in the history
Fixed Django 2.0 compatibility.
  • Loading branch information
dcramer authored Jun 26, 2017
2 parents c63cc64 + 82b4622 commit 71c793e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
13 changes: 10 additions & 3 deletions tests/contrib/django/test_resolver.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from __future__ import absolute_import

import django

try:
from django.conf.urls import url, include
except ImportError:
Expand All @@ -8,9 +10,14 @@

from raven.contrib.django.resolver import RouteResolver

included_url_conf = (
url(r'^foo/bar/(?P<param>[\w]+)', lambda x: ''),
), '', ''
if django.VERSION < (1, 9):
included_url_conf = (
url(r'^foo/bar/(?P<param>[\w]+)', lambda x: ''),
), '', ''
else:
included_url_conf = ((
url(r'^foo/bar/(?P<param>[\w]+)', lambda x: ''),
), '')

example_url_conf = (
url(r'^api/(?P<project_id>[\w_-]+)/store/$', lambda x: ''),
Expand Down
7 changes: 6 additions & 1 deletion tests/contrib/django/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import SuspiciousOperation
from django.core.urlresolvers import reverse
from django.core.signals import got_request_exception
from django.core.handlers.wsgi import WSGIRequest
from django.http import QueryDict
Expand All @@ -23,6 +22,12 @@
from django.utils.translation import gettext_lazy
from exam import fixture

try:
from django.urls import reverse
except ImportError:
# For Django version less than 1.10.
from django.core.urlresolvers import reverse

from raven.base import Client
from raven.utils.compat import StringIO, iteritems, PY2, string_types, text_type
from raven.contrib.django.client import DjangoClient
Expand Down

0 comments on commit 71c793e

Please sign in to comment.