瀏覽代碼

[core] Avoid exception in 500 stack printing view with Python 2

https://docs.python.org/2/library/traceback.html

  File "/opt/cloudera/parcels/CDH-7.2.9-1.cdh7.2.9.p1.14166188/lib/hue/desktop/core/src/desktop/views.py", line 463, in serve_500_error
    tb = '\n'.join(tb.format())
AttributeError: 'list' object has no attribute 'format'
Romain Rigaux 4 年之前
父節點
當前提交
8544bff41a
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      desktop/core/src/desktop/views.py

+ 1 - 1
desktop/core/src/desktop/views.py

@@ -460,7 +460,7 @@ def serve_500_error(request, *args, **kwargs):
       else:
         tb = traceback.extract_tb(exc_info[2])
         if is_ajax(request):
-          tb = '\n'.join(tb.format())
+          tb = '\n'.join(tb.format() if sys.version_info[0] > 2 else [str(t) for t in tb])
         return render("500.mako", request, {'traceback': tb})
     else:
       # exc_info could be empty