Explorar el Código

Task methods: fixes apply_async if args is None. Closes #1459

Ask Solem hace 11 años
padre
commit
c5be3ce5b1
Se han modificado 1 ficheros con 3 adiciones y 2 borrados
  1. 3 2
      celery/app/task.py

+ 3 - 2
celery/app/task.py

@@ -486,9 +486,10 @@ class Task(object):
         if app.conf.CELERY_ALWAYS_EAGER:
             return self.apply(args, kwargs, task_id=task_id or uuid(),
                               link=link, link_error=link_error, **options)
-        # add 'self' if this is a bound method.
+        # add 'self' if this is a "task_method".
         if self.__self__ is not None:
-            args = (self.__self__, ) + tuple(args)
+            args = args if isinstance(args, tuple) else tuple(args or ())
+            args = (self.__self__, ) + args
         return app.send_task(
             self.name, args, kwargs, task_id=task_id, producer=producer,
             link=link, link_error=link_error, result_cls=self.AsyncResult,