Prechádzať zdrojové kódy

fixes broken refactoring attempt

Ask Solem 12 rokov pred
rodič
commit
c3eec20fcd
2 zmenil súbory, kde vykonal 7 pridanie a 17 odobranie
  1. 7 1
      celery/app/base.py
  2. 0 16
      celery/loaders/base.py

+ 7 - 1
celery/app/base.py

@@ -46,6 +46,12 @@ BUILTIN_FIXUPS = frozenset([
     'celery.fixups.django:fixup',
 ])
 
+ERROR_ENVVAR_NOT_SET = """\
+The environment variable {0!r} is not set,
+and as such the configuration could not be loaded.
+Please set this variable and make it point to
+a configuration module."""
+
 
 def app_has_custom(app, attr):
     return mro_lookup(app.__class__, attr, stop=(Celery, object),
@@ -247,7 +253,7 @@ class Celery(object):
         if not module_name:
             if silent:
                 return False
-            raise ImproperlyConfigured(self.error_envvar_not_set % module_name)
+            raise ImproperlyConfigured(ERROR_ENVVAR_NOT_SET % module_name)
         return self.config_from_object(module_name, silent=silent)
 
     def config_from_cmdline(self, argv, namespace='celery'):

+ 0 - 16
celery/loaders/base.py

@@ -28,12 +28,6 @@ from celery.utils.imports import (
     import_from_cwd, symbol_by_name, NotAPackage, find_module,
 )
 
-ERROR_ENVVAR_NOT_SET = """\
-The environment variable {0!r} is not set,
-and as such the configuration could not be loaded.
-Please set this variable and make it point to
-a configuration module."""
-
 _RACE_PROTECTION = False
 CONFIG_INVALID_NAME = """\
 Error: Module '{module}' doesn't exist, or it's not a valid \
@@ -66,7 +60,6 @@ class BaseLoader(object):
     """
     builtin_modules = frozenset()
     configured = False
-    error_envvar_not_set = ERROR_ENVVAR_NOT_SET
     override_backends = {}
     worker_initialized = False
 
@@ -139,15 +132,6 @@ class BaseLoader(object):
     def init_worker_process(self):
         self.on_worker_process_init()
 
-    def config_from_envvar(self, variable_name, silent=False):
-        module_name = os.environ.get(variable_name)
-        if not module_name:
-            if silent:
-                return False
-            raise ImproperlyConfigured(
-                self.error_envvar_not_set.format(module_name))
-        return self.config_from_object(module_name, silent=silent)
-
     def config_from_object(self, obj, silent=False):
         if isinstance(obj, string_t):
             try: