Commits

ianschenck  committed a807dad

celery.imports are now imported on_worker_init

  • Participants
  • Parent commits 0c1d0f3

Comments (0)

Files changed (1)

File celerypylons/loader.py

 from celery.loaders.base import BaseLoader
 from pylons import config
+import types
 
 
 to_pylons = lambda x: x.replace('_','.').lower()
     def read_configuration(self):
         self.configured = True
         return PylonsSettingsProxy()
+
+    def on_worker_init(self):
+        """
+        Import task modules.
+        """
+        # @@ Patch for when user only provides 1 module
+        celery_imports = config.get('celery.imports', [])
+        if isinstance(celery_imports, types.StringTypes):
+            config['celery.imports'] = [celery_imports]
+        self.import_default_modules()