소스 검색

Ignore ImportErrors when importing the django memcached backend.

Ask Solem 15 년 전
부모
커밋
1f9b69c9c7
1개의 변경된 파일7개의 추가작업 그리고 3개의 파일을 삭제
  1. 7 3
      celery/backends/cache.py

+ 7 - 3
celery/backends/cache.py

@@ -32,9 +32,13 @@ class DjangoMemcacheWrapper(object):
 # Check if django is using memcache as the cache backend. If so, wrap the
 # cache object in a DjangoMemcacheWrapper that fixes a bug with retrieving
 # pickled data
-from django.core.cache.backends.memcached import CacheClass
-if isinstance(cache, CacheClass):
-    cache = DjangoMemcacheWrapper(cache)
+try:
+    from django.core.cache.backends.memcached import CacheClass
+except ImportError:
+    pass
+else:
+    if isinstance(cache, CacheClass):
+        cache = DjangoMemcacheWrapper(cache)
 
 
 class CacheBackend(KeyValueStoreBackend):