1. Erik van Zijst
  2. dogslow

Commits

Erik van Zijst  committed 6bc6ab7

Don't crash on Django 1.2 when DOGSLOW_IGNORE_URLS is not being used.

  • Participants
  • Parent commits 16c68cf
  • Branches default

Comments (0)

Files changed (2)

File README.rst

View file
  • Ignore whitespace
 
     # Tuple of url pattern names that should not be monitored:
     # (defaults to none -- everything monitored)
+    # Note: this option is not compatible with Django < 1.3
     DOGSLOW_IGNORE_URLS = ('some_view', 'other_view')
 
     # Print (potentially huge!) local stack variables (off by default, use

File dogslow/__init__.py

View file
  • Ignore whitespace
         """Returns True if this request's URL resolves to a url pattern whose
         name is listed in settings.DOGSLOW_IGNORE_URLS.
         """
-        try:
-            match = resolve(request.META.get('PATH_INFO'))
-        except Resolver404:
+        exemptions = getattr(settings, 'DOGSLOW_IGNORE_URLS', ())
+        if exemptions:
+            try:
+                match = resolve(request.META.get('PATH_INFO'))
+            except Resolver404:
+                return False
+            return match and (match.url_name in exemptions)
+        else:
             return False
-        return match and (match.url_name in
-                          getattr(settings, 'DOGSLOW_IGNORE_URLS', ()))
 
     def process_request(self, request):
         if not self._is_exempt(request):