Sfoglia il codice sorgente

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

Ask Solem 11 anni fa
parent
commit
c5be3ce5b1
1 ha cambiato i file con 3 aggiunte e 2 eliminazioni
  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,