Issue: cgitb text formatter outputs all members of exception object, using standard dir() to get their names. My patch changes its behaviour to skip fields which are callable, since printing them only clutters the output but is rarely helpful. HTML formatter skips members starting with underscore (_), which is slightly different behaviour and I can alter my patch to make both formatters behave in the same way, should the need be. Both can skip members starting with underscore, callables, or callables and values starting with underscore - any option will be better than printing them all. Current change alters output for exception value Exception("123412312") from: <type 'exceptions.Exception'>: 123412312 __class__ = <type 'exceptions.Exception'> __delattr__ = <method-wrapper '__delattr__' of exceptions.Exception object> __dict__ = {} __doc__ = 'Common base class for all non-exit exceptions.' __format__ = <built-in method __format__ of exceptions.Exception object> __getattribute__ = <method-wrapper '__getattribute__' of exceptions.Exception object> __getitem__ = <method-wrapper '__getitem__' of exceptions.Exception object> __getslice__ = <method-wrapper '__getslice__' of exceptions.Exception object> __hash__ = <method-wrapper '__hash__' of exceptions.Exception object> __init__ = <method-wrapper '__init__' of exceptions.Exception object> __new__ = <built-in method __new__ of type object> __reduce__ = <built-in method __reduce__ of exceptions.Exception object> __reduce_ex__ = <built-in method __reduce_ex__ of exceptions.Exception object> __repr__ = <method-wrapper '__repr__' of exceptions.Exception object> __setattr__ = <method-wrapper '__setattr__' of exceptions.Exception object> __setstate__ = <built-in method __setstate__ of exceptions.Exception object> __sizeof__ = <built-in method __sizeof__ of exceptions.Exception object> __str__ = <method-wrapper '__str__' of exceptions.Exception object> __subclasshook__ = <built-in method __subclasshook__ of type object> __unicode__ = <built-in method __unicode__ of exceptions.Exception object> args = ('123412312',) message = '123412312' to: <type 'exceptions.Exception'>: 123412312 __dict__ = {} __doc__ = 'Common base class for all non-exit exceptions.' args = ('123412312',) message = '123412312'
Hi Adam, Thanks for the patch. I reviewed it. It's a good change. As you mentioned in the comments, making both HTML and Text formatter behave consistently and skip, underscores, callables, _callables will be a good idea. Please include change. Also, if there is a test coverage for this change, it will be great. Thanks!