소스 검색

DefaultLoader.read_configuration now supports fail_silently argument

Ask Solem 11 년 전
부모
커밋
29a2204b03
1개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 1
      celery/loaders/default.py

+ 3 - 1
celery/loaders/default.py

@@ -31,7 +31,7 @@ class Loader(BaseLoader):
     def setup_settings(self, settingsdict):
         return DictAttribute(settingsdict)
 
-    def read_configuration(self):
+    def read_configuration(self, fail_silently=True):
         """Read configuration from :file:`celeryconfig.py` and configure
         celery and Django so it can be used by regular Python."""
         configname = os.environ.get('CELERY_CONFIG_MODULE',
@@ -39,6 +39,8 @@ class Loader(BaseLoader):
         try:
             usercfg = self._import_config_module(configname)
         except ImportError:
+            if not fail_silently:
+                raise
             # billiard sets this if forked using execv
             if C_WNOCONF and not os.environ.get('FORKED_BY_MULTIPROCESSING'):
                 warnings.warn(NotConfigured(