Explorar el Código

@task should raise if args passed. Closes #1125

Ask Solem hace 12 años
padre
commit
39536895b9
Se han modificado 2 ficheros con 4 adiciones y 1 borrados
  1. 1 1
      celery/app/__init__.py
  2. 3 0
      celery/app/base.py

+ 1 - 1
celery/app/__init__.py

@@ -133,4 +133,4 @@ def shared_task(*args, **kwargs):
 
     if len(args) == 1 and callable(args[0]):
         return create_shared_task(**kwargs)(args[0])
-    return create_shared_task(**kwargs)
+    return create_shared_task(*args, **kwargs)

+ 3 - 0
celery/app/base.py

@@ -172,6 +172,9 @@ class Celery(object):
 
         if len(args) == 1 and callable(args[0]):
             return inner_create_task_cls(**opts)(*args)
+        if args:
+            raise TypeError(
+                'task() takes no arguments (%s given)' % (len(args, )))
         return inner_create_task_cls(**opts)
 
     def _task_from_fun(self, fun, **options):