##// END OF EJS Templates
- Fix exception name printing for Python 2.5.
fperez -
Show More
@@ -60,7 +60,7 b' You can implement other color schemes easily, the syntax is fairly'
60 self-explanatory. Please send back new schemes you develop to the author for
60 self-explanatory. Please send back new schemes you develop to the author for
61 possible inclusion in future releases.
61 possible inclusion in future releases.
62
62
63 $Id: ultraTB.py 2156 2007-03-19 02:32:19Z fperez $"""
63 $Id: ultraTB.py 2419 2007-06-01 07:31:42Z fperez $"""
64
64
65 #*****************************************************************************
65 #*****************************************************************************
66 # Copyright (C) 2001 Nathaniel Gray <n8gray@caltech.edu>
66 # Copyright (C) 2001 Nathaniel Gray <n8gray@caltech.edu>
@@ -342,9 +342,9 b' class ListTB(TBTools):'
342
342
343 Colors = self.Colors
343 Colors = self.Colors
344 list = []
344 list = []
345 if type(etype) == types.ClassType:
345 try:
346 stype = Colors.excName + etype.__name__ + Colors.Normal
346 stype = Colors.excName + etype.__name__ + Colors.Normal
347 else:
347 except AttributeError:
348 stype = etype # String exceptions don't get special coloring
348 stype = etype # String exceptions don't get special coloring
349 if value is None:
349 if value is None:
350 list.append( str(stype) + '\n')
350 list.append( str(stype) + '\n')
@@ -419,13 +419,17 b' class VerboseTB(TBTools):'
419 """Return a nice text document describing the traceback."""
419 """Return a nice text document describing the traceback."""
420
420
421 # some locals
421 # some locals
422 try:
423 etype = etype.__name__
424 except AttributeError:
425 pass
422 Colors = self.Colors # just a shorthand + quicker name lookup
426 Colors = self.Colors # just a shorthand + quicker name lookup
423 ColorsNormal = Colors.Normal # used a lot
427 ColorsNormal = Colors.Normal # used a lot
424 col_scheme = self.color_scheme_table.active_scheme_name
428 col_scheme = self.color_scheme_table.active_scheme_name
425 indent = ' '*INDENT_SIZE
429 indent = ' '*INDENT_SIZE
426 exc = '%s%s%s' % (Colors.excName, str(etype), ColorsNormal)
427 em_normal = '%s\n%s%s' % (Colors.valEm, indent,ColorsNormal)
430 em_normal = '%s\n%s%s' % (Colors.valEm, indent,ColorsNormal)
428 undefined = '%sundefined%s' % (Colors.em, ColorsNormal)
431 undefined = '%sundefined%s' % (Colors.em, ColorsNormal)
432 exc = '%s%s%s' % (Colors.excName,etype,ColorsNormal)
429
433
430 # some internal-use functions
434 # some internal-use functions
431 def text_repr(value):
435 def text_repr(value):
@@ -459,8 +463,10 b' class VerboseTB(TBTools):'
459 def nullrepr(value, repr=text_repr): return ''
463 def nullrepr(value, repr=text_repr): return ''
460
464
461 # meat of the code begins
465 # meat of the code begins
462 if type(etype) is types.ClassType:
466 try:
463 etype = etype.__name__
467 etype = etype.__name__
468 except AttributeError:
469 pass
464
470
465 if self.long_header:
471 if self.long_header:
466 # Header with the exception type, python version, and date
472 # Header with the exception type, python version, and date
@@ -1,3 +1,9 b''
1 2007-06-01 Fernando Perez <Fernando.Perez@colorado.edu>
2
3 * IPython/ultraTB.py (VerboseTB.text): update printing of
4 exception types for Python 2.5 (now all exceptions in the stdlib
5 are new-style classes).
6
1 2007-05-31 Walter Doerwald <walter@livinglogic.de>
7 2007-05-31 Walter Doerwald <walter@livinglogic.de>
2
8
3 * IPython/Extensions/igrid.py: Add new commands refresh and
9 * IPython/Extensions/igrid.py: Add new commands refresh and
General Comments 0
You need to be logged in to leave comments. Login now