Parcourir la source

Resolve ei in formatException. Closes #899

Ask Solem il y a 12 ans
Parent
commit
80dad7355d
1 fichiers modifiés avec 2 ajouts et 0 suppressions
  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
         self.use_color = use_color
 
 
     def formatException(self, ei):
     def formatException(self, ei):
+        if ei and not isinstance(ei, tuple):
+            ei = sys.exc_info()
         r = logging.Formatter.formatException(self, ei)
         r = logging.Formatter.formatException(self, ei)
         if isinstance(r, str) and not is_py3k:
         if isinstance(r, str) and not is_py3k:
             return safe_str(r)
             return safe_str(r)