aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/cgitb.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/cgitb.py')
-rw-r--r--Lib/cgitb.py20
1 files changed, 9 insertions, 11 deletions
diff --git a/Lib/cgitb.py b/Lib/cgitb.py
index 8acc4b75fe3..6da40e82ece 100644
--- a/Lib/cgitb.py
+++ b/Lib/cgitb.py
@@ -102,7 +102,7 @@ def scanvars(reader, frame, locals):
def html(einfo, context=5):
"""Return a nice HTML document describing a given traceback."""
etype, evalue, etb = einfo
- if type(etype) is types.ClassType:
+ if isinstance(etype, type):
etype = etype.__name__
pyver = 'Python ' + sys.version.split()[0] + ': ' + sys.executable
date = time.ctime(time.time())
@@ -172,11 +172,10 @@ function calls leading up to the error, in the order they occurred.</p>'''
exception = ['<p>%s: %s' % (strong(pydoc.html.escape(str(etype))),
pydoc.html.escape(str(evalue)))]
- if isinstance(evalue, BaseException):
- for name in dir(evalue):
- if name[:1] == '_': continue
- value = pydoc.html.repr(getattr(evalue, name))
- exception.append('\n<br>%s%s&nbsp;=\n%s' % (indent, name, value))
+ for name in dir(evalue):
+ if name[:1] == '_': continue
+ value = pydoc.html.repr(getattr(evalue, name))
+ exception.append('\n<br>%s%s&nbsp;=\n%s' % (indent, name, value))
return head + ''.join(frames) + ''.join(exception) + '''
@@ -193,7 +192,7 @@ function calls leading up to the error, in the order they occurred.</p>'''
def text(einfo, context=5):
"""Return a plain text document describing a given traceback."""
etype, evalue, etb = einfo
- if type(etype) is types.ClassType:
+ if isinstance(etype, type):
etype = etype.__name__
pyver = 'Python ' + sys.version.split()[0] + ': ' + sys.executable
date = time.ctime(time.time())
@@ -243,10 +242,9 @@ function calls leading up to the error, in the order they occurred.
frames.append('\n%s\n' % '\n'.join(rows))
exception = ['%s: %s' % (str(etype), str(evalue))]
- if isinstance(evalue, BaseException):
- for name in dir(evalue):
- value = pydoc.text.repr(getattr(evalue, name))
- exception.append('\n%s%s = %s' % (" "*4, name, value))
+ for name in dir(evalue):
+ value = pydoc.text.repr(getattr(evalue, name))
+ exception.append('\n%s%s = %s' % (" "*4, name, value))
return head + ''.join(frames) + ''.join(exception) + '''