Compatibility with older versions of Python
Looks like the latest version of dogslow doesn't work with older versions of Python. I chatted with Erik about this -- maybe this is caused by a django url pattern not having a name.
Here's the stacktrace:
File "/Library/Python/2.6/site-packages/django/core/handlers/base.py" in get_response
80. response = middleware_method(request)
File "/Library/Python/2.6/site-packages/dogslow/__init__.py" in process_request
174. if not self._is_exempt(request):
File "/Library/Python/2.6/site-packages/dogslow/__init__.py" in _is_exempt
170. return match and (match.url_name in
Exception Type: AttributeError at /
Exception Value: 'tuple' object has no attribute 'url_name'
Comments (7)
-
-
Account Deleted I am experiencing exactly the same problem on Django Version 1.2.1 so not sure if Ticket #13922 was provided there. Please advice of a workaround without upgrading Django versions.
-
repo owner It would appear that the snippet provided by @thezilch would work around the problem.
It'd be awesome if you could give that a go and report back. I'm happy to pull it in.
-
repo owner -
assigned issue to
- changed status to open
-
assigned issue to
-
reporter - edited description
-
reporter I was just curious what versions of Django were supported and stumbled upon this old issue. Too bad I didn't list the version I was trying to use here. But I'm pretty sure Dogslow works with Django 1.4, so perhaps close this issue since anything older than that isn't even supported by the Django project.
-
For the next release, I'm targeting the currently-supported Django versions, which are 1.8, 1.10, and 1.11. It will probably also work with older versions.
Django 1.10 introduced a new middleware interface and deprecated the MIDDLEWARE_CLASSES interface that we use, so at some point we should at least introduce an adaptor to the new system.
- Log in to comment
This issue is an issue with Django compatibility and not Python. See https://code.djangoproject.com/ticket/13922 for the change of django.core.urlresolvers.resolve no longer returning a tuple, which was released with Django 1.2. Prior to 1.2, it doesn't appear simple to get the url_name.
Similarly, custom loggers will break in similar fashion, which also attempt to resolve a url_name when passing a warning to the logger.