From 3ea1fa8c5c5b088bf6b05ff8320efbad25d628dc Mon Sep 17 00:00:00 2001 From: Jannis Leidel <jannis@leidel.info> Date: Wed, 27 Jun 2012 16:19:01 +0200 Subject: [PATCH] Fixed Celery 1.X support. --- celery_haystack/tasks.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/celery_haystack/tasks.py b/celery_haystack/tasks.py index db5de7d..da84d22 100644 --- a/celery_haystack/tasks.py +++ b/celery_haystack/tasks.py @@ -11,7 +11,7 @@ try: legacy = False except ImportError: try: - from haystack import site as index_holder # noqa + from haystack import site from haystack.exceptions import NotRegistered as IndexNotFoundException # noqa legacy = True except ImportError, e: @@ -88,7 +88,9 @@ class CeleryHaystackSignalHandler(Task): Fetch the model's registered ``SearchIndex`` in a standarized way. """ try: - if not legacy: + if legacy: + index_holder = site + else: backend_alias = connection_router.for_write(**{'models': [model_class]}) index_holder = connections[backend_alias].get_unified_index() # noqa return index_holder.get_index(model_class) -- GitLab