瀏覽代碼

worker.jail: Convert any unicode keys in kwargs to regular strings. Thanks
howsthedotcom.

Ask Solem 16 年之前
父節點
當前提交
54fdec01b0
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      celery/worker.py

+ 3 - 0
celery/worker.py

@@ -45,6 +45,9 @@ def jail(task_id, func, args, kwargs):
         the exception instance on failure.
         the exception instance on failure.
 
 
     """
     """
+    # Convert any unicode keys in the keyword arguments to ascii.
+    kwargs = dict([(k.encode("utf-8"), v)
+                        for k, v in kwargs.items()])
     try:
     try:
         result = func(*args, **kwargs)
         result = func(*args, **kwargs)
     except Exception, exc:
     except Exception, exc: