From 2226de139b6e177bfbe2824b1749478dbcce3318 Mon Sep 17 00:00:00 2001 From: Dave Hall Date: Mon, 27 Nov 2017 08:54:17 +0000 Subject: [PATCH] Fixing flake8 --- tests/test_watson/tests.py | 4 ++-- watson/middleware.py | 2 +- watson/search.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_watson/tests.py b/tests/test_watson/tests.py index adbea5d..89b9b91 100644 --- a/tests/test_watson/tests.py +++ b/tests/test_watson/tests.py @@ -14,7 +14,7 @@ import string try: from unittest import skipUnless -except: +except ImportError: from django.utils.unittest import skipUnless from django.test import TestCase @@ -186,7 +186,7 @@ class InternalsTest(SearchTestBase): self.test11.title = "fooo" self.test11.save() raise Exception("Foo") - except: + except Exception: pass # Test a search that should get not model. self.assertEqual(watson.search("fooo").count(), 0) diff --git a/watson/middleware.py b/watson/middleware.py index ae01317..305a9eb 100644 --- a/watson/middleware.py +++ b/watson/middleware.py @@ -6,7 +6,7 @@ from django.core.exceptions import ImproperlyConfigured try: from django.utils.deprecation import MiddlewareMixin cls = MiddlewareMixin -except: +except ImportError: cls = object from watson.search import search_context_manager diff --git a/watson/search.py b/watson/search.py index ee5d8b3..0b78ec9 100644 --- a/watson/search.py +++ b/watson/search.py @@ -320,7 +320,7 @@ class SearchContext(object): exception = False try: return func(*args, **kwargs) - except: + except Exception: exception = True if not self.__exit__(*sys.exc_info()): raise