Преглед на файлове

maybe_signature(list) will now recurse. Closes #1645

Ask Solem преди 11 години
родител
ревизия
cf20072e30
променени са 2 файла, в които са добавени 8 реда и са изтрити 4 реда
  1. 1 1
      celery/app/builtins.py
  2. 7 3
      celery/canvas.py

+ 1 - 1
celery/app/builtins.py

@@ -377,7 +377,7 @@ def add_chord_task(app):
                 return self.apply(args, kwargs, **options)
             header = kwargs.pop('header')
             body = kwargs.pop('body')
-            header, body = (list(maybe_signature(header, app=app)),
+            header, body = (maybe_signature(header, app=app),
                             maybe_signature(body, app=app))
             # forward certain options to body
             if chord is not None:

+ 7 - 3
celery/canvas.py

@@ -605,10 +605,14 @@ subtask = signature   # XXX compat
 
 
 def maybe_signature(d, app=None):
-    if d is not None and isinstance(d, dict):
-        if not isinstance(d, Signature):
-            return signature(d, app=app)
+    if d is not None:
+        if isinstance(d, dict):
+            if not isinstance(d, Signature):
+                return signature(d, app=app)
+        elif isinstance(d, list):
+            return [maybe_signature(s, app=app) for s in d]
         if app is not None:
             d._app = app
         return d
+
 maybe_subtask = maybe_signature  # XXX compat