~hardware-certification/zope3/certify-staging-2.5

« back to all changes in this revision

Viewing changes to src/zope/app/debugskin/exceptions.py

  • Committer: Certification
  • Date: 2008-09-30 16:37:39 UTC
  • mfrom: (8.1.4 certify-zope3)
  • Revision ID: certification@macaroni-20080930163739-9badk5xhyh8nhy5k
Merged changes from trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
##############################################################################
 
2
#
 
3
# Copyright (c) 2003 Zope Corporation and Contributors.
 
4
# All Rights Reserved.
 
5
#
 
6
# This software is subject to the provisions of the Zope Public License,
 
7
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
 
8
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 
9
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 
10
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 
11
# FOR A PARTICULAR PURPOSE.
 
12
#
 
13
##############################################################################
 
14
"""View that renders a traceback for exceptions.
 
15
 
 
16
$Id: exceptions.py 26727 2004-07-23 21:13:09Z pruggera $
 
17
"""
 
18
__docformat__ = 'restructuredtext'
 
19
 
 
20
import sys
 
21
import traceback
 
22
 
 
23
from zope.interface.common.interfaces import IException
 
24
 
 
25
class ExceptionDebugView(object):
 
26
    """ Render exceptions for debugging."""
 
27
    __used_for__ = IException
 
28
 
 
29
    def __init__(self, context, request):
 
30
 
 
31
        self.context = context
 
32
        self.request = request
 
33
 
 
34
        self.error_type, self.error_object, tb = sys.exc_info()
 
35
        try:
 
36
            self.traceback_lines = traceback.format_tb(tb)
 
37
        finally:
 
38
            del tb