Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix Django deprecation warning #165

Merged
merged 2 commits into from
May 23, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion rollbar/contrib/django/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,16 @@

import rollbar

import django
from django.core.exceptions import MiddlewareNotUsed
from django.core.urlresolvers import resolve
from django.conf import settings
from django.http import Http404

if django.VERSION >= (1, 10):
Copy link
Contributor

@ezarowny ezarowny May 22, 2017

Choose a reason for hiding this comment

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

Hmm, I'm not sure if this is the right way to do this particular comparison. django.VERSION usually has text in it. For example, (1, 11, 1, u'final', 0).

I know this is probably not necessary and really corner case-y, but I think it might be better to do an import check similar to how we handle MiddlewareMixin below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the link. That's definitely something to consider since a method could change to a property and vice-versa. I'm going to file an internal ticket to discuss with the team.

from django.urls import resolve
else:
from django.core.urlresolvers import resolve

try:
from django.utils.deprecation import MiddlewareMixin
except ImportError:
Expand Down