瀏覽代碼

[canvas] Support primtitives that does not define from_dict

Ask Solem 9 年之前
父節點
當前提交
906f923666
共有 1 個文件被更改,包括 4 次插入2 次删除
  1. 4 2
      celery/canvas.py

+ 4 - 2
celery/canvas.py

@@ -153,10 +153,12 @@ class Signature(dict):
         return subclass
 
     @classmethod
-    def from_dict(self, d, app=None):
+    def from_dict(cls, d, app=None):
         typ = d.get('subtask_type')
         if typ:
-            return self.TYPES[typ].from_dict(d, app=app)
+            target_cls = cls.TYPES[typ]
+            if target_cls is not cls:
+                return target_cls.from_dict(d, app=app)
         return Signature(d, app=app)
 
     def __init__(self, task=None, args=None, kwargs=None, options=None,