浏览代码

Resolve ei in formatException. Closes #899

Ask Solem 12 年之前
父节点
当前提交
80dad7355d
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      celery/utils/log.py

+ 2 - 0
celery/utils/log.py

@@ -74,6 +74,8 @@ class ColorFormatter(logging.Formatter):
         self.use_color = use_color
 
     def formatException(self, ei):
+        if ei and not isinstance(ei, tuple):
+            ei = sys.exc_info()
         r = logging.Formatter.formatException(self, ei)
         if isinstance(r, str) and not is_py3k:
             return safe_str(r)