From 99d395d6b3d7a41f47e532eb2bf90197f92e69f6 Mon Sep 17 00:00:00 2001 From: ianb Date: Wed, 23 Aug 2006 19:11:30 +0000 Subject: Fixed a bug in the registry test (not code), since str(registered_object) never fails anymore. Fixed some formatting because of new-style exceptions in Python 2.5 --- paste/exceptions/collector.py | 4 ++-- paste/exceptions/formatter.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'paste/exceptions') diff --git a/paste/exceptions/collector.py b/paste/exceptions/collector.py index 2b454e5..93eee4c 100644 --- a/paste/exceptions/collector.py +++ b/paste/exceptions/collector.py @@ -95,7 +95,7 @@ class ExceptionCollector: ``exception_formatted``: The formatted exception, generally a full traceback ``exception_type``: - The string type of the exception, like ``'ValueError'`` + The type of the exception, like ``ValueError`` ``exception_value``: The string value of the exception, like ``'x not in list'`` ``identification_code``: @@ -346,7 +346,7 @@ class ExceptionCollector: result = CollectedException( frames=frames, exception_formatted=self.collectExceptionOnly(etype, value), - exception_type=str(etype), + exception_type=etype, exception_value=str(value), identification_code=ident, date=time.localtime(), diff --git a/paste/exceptions/formatter.py b/paste/exceptions/formatter.py index 4aa876b..2b51b38 100644 --- a/paste/exceptions/formatter.py +++ b/paste/exceptions/formatter.py @@ -75,8 +75,11 @@ class AbstractFormatter(object): if source: lines.append(self.format_long_source( source, long_source)) + etype = exc_data.exception_type + if not isinstance(etype, basestring): + etype = etype.__name__ exc_info = self.format_exception_info( - exc_data.exception_type, + etype, exc_data.exception_value) data_by_importance = {'important': [], 'normal': [], 'supplemental': [], 'extra': []} -- cgit v1.2.1