Commits

Anonymous committed d0e1f4a

Tests are passing now

Comments (0)

Files changed (2)

celerypaste/__init__.py

-#from celery.loaders.base import BaseLoader
-from celery.loaders.default import Loader
+import os
+import imp
+
 from paste.script.command import Command, BadCommand
 from paste.deploy import appconfig
-import os
-import imp
+
+from celery.loaders.default import Loader
 
 KEY_ENV_LOADER = "CELERY_LOADER"
 
         self._config = config
 
     def read_configuration(self):
-        config = {}
-        config.update(self._config)
-        #this trips up django, and paste puts this in by default
-        if "tasks" in config:
-            init_tasks = config.pop("tasks")
-        else:
-            init_tasks = None
-
-        if "__file__" in config:
-            config.pop("__file__")
+        config = dict(self._config)
+        init_tasks = config.pop("tasks", None) # XXX What is this?
+        # this trips up django, and paste puts this in by default
+        config.pop("__file__", None)
         self.django_settings = self.setup_django_env(config)
-        self.init_tasks(init_tasks)
-
         return self.django_settings
 
-    def init_tasks(self, init_tasks):
-        """
-        import this module, seems to be the thing to do
-        """
-        print init_tasks
-        self.tasks_module = imp.load_source(\
-            os.path.basename(init_tasks)[:-3], init_tasks)
-
 
 class PasteLoaderFactory(object):
 

tests/test_run.py

 
 from celerypaste import set_loader
 
-CELERY_CONFIG ={"BROKER_HOST": "localhost",
-                "BROKER_PORT": 5672,
-                "BROKER_VHOST": "celeryTst",
-                "BROKER_USER": "celery",
-                "BROKER_PASSWORD": "celery",
-                "CELERY_BACKEND": "database",
-                "DATABASE_ENGINE": "sqlite3",
-                "DATABASE_NAME": "test.db",
-                "CELERY_IMPORTS": ("mytasks", )}
+CELERY_CONFIG = {"BROKER_HOST": "localhost",
+                 "BROKER_PORT": 5672,
+                 "BROKER_VHOST": "celeryTst",
+                 "BROKER_USER": "celery",
+                 "BROKER_PASSWORD": "celery",
+                 "CELERY_BACKEND": "database",
+                 "DATABASE_ENGINE": "sqlite3",
+                 "DATABASE_NAME": "test.db",
+                 "CELERY_IMPORTS": ("mytasks", )}
 
 
 set_loader(CELERY_CONFIG)