Skip to content

Commit 2c515d4

Browse files
committed
Merge pull request django-haystack#22 from stefanw/python-3
Convert to PEP 3110 style exception catching
2 parents f0f56d1 + e2d2038 commit 2c515d4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

celery_haystack/tasks.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from haystack import site
1414
from haystack.exceptions import NotRegistered as IndexNotFoundException # noqa
1515
legacy = True
16-
except ImportError, e:
16+
except ImportError as e:
1717
raise ImproperlyConfigured("Haystack couldn't be imported: %s" % e)
1818

1919
if settings.CELERY_HAYSTACK_TRANSACTION_SAFE and not getattr(settings, 'CELERY_ALWAYS_EAGER', False):
@@ -125,7 +125,7 @@ def run(self, action, identifier, **kwargs):
125125
try:
126126
handler_options = self.get_handler_options(**kwargs)
127127
current_index.remove_object(identifier, **handler_options)
128-
except Exception, exc:
128+
except Exception as exc:
129129
logger.exception(exc)
130130
self.retry(exc=exc)
131131
else:
@@ -146,7 +146,7 @@ def run(self, action, identifier, **kwargs):
146146
try:
147147
handler_options = self.get_handler_options(**kwargs)
148148
current_index.update_object(instance, **handler_options)
149-
except Exception, exc:
149+
except Exception as exc:
150150
logger.exception(exc)
151151
self.retry(exc=exc)
152152
else:

celery_haystack/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def get_update_task(task_path=None):
1111
module, attr = import_path.rsplit('.', 1)
1212
try:
1313
mod = import_module(module)
14-
except ImportError, e:
14+
except ImportError as e:
1515
raise ImproperlyConfigured('Error importing module %s: "%s"' %
1616
(module, e))
1717
try:

0 commit comments

Comments
 (0)