浏览代码

Raise NotRegistered in delay_task() if the task is not in the registry.

Ask Solem 16 年之前
父节点
当前提交
fad3646d58
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      crunchy/task.py

+ 4 - 4
crunchy/task.py

@@ -5,10 +5,10 @@ from crunchy.discovery import autodiscover
 
 
 def delay_task(task_name, **kwargs):
-    #if task_name not in tasks:
-    #    raise tasks.NotRegistered(
-    #            "Task with name %s not registered in the task registry." % (
-    #                task_name))
+    if task_name not in tasks:
+        raise tasks.NotRegistered(
+                "Task with name %s not registered in the task registry." % (
+                    task_name))
     publisher = TaskPublisher(connection=DjangoAMQPConnection)
     task_id = publisher.delay_task(task_name, **kwargs)
     publisher.close()