[Zope3-checkins] CVS: Zope3/src/zope/app/browser/skins/debug - __init__.py:1.1 configure.zcml:1.1 error_debug.pt:1.1 exceptions.py:1.1
Tres Seaver
tseaver@zope.com
Tue, 11 Mar 2003 18:12:34 -0500
Update of /cvs-repository/Zope3/src/zope/app/browser/skins/debug
In directory cvs.zope.org:/tmp/cvs-serv9444/debug
Added Files:
__init__.py configure.zcml error_debug.pt exceptions.py
Log Message:
- Add a 'debug' skin layer, with a "traceback display" view registered
against IException.
- Define a 'Debug' skin, which adds this layer to the two layers of
the 'Rotterdam' skin.
Usage:
If you have a request which blows an exception out beyond the publisher,
you can repeat the request, prefixing the path with '++Debug++', to see
the traceback in the output (rather than having to switch context to the
error logging service). Particularly useful during application
development.
=== Added File Zope3/src/zope/app/browser/skins/debug/__init__.py ===
##
=== Added File Zope3/src/zope/app/browser/skins/debug/configure.zcml ===
<zopeConfigure
xmlns='http://namespaces.zope.org/zope'
xmlns:browser='http://namespaces.zope.org/browser'
>
<browser:skin name="Debug" layers="debug rotterdam default" />
<browser:page
name="index.html"
template="error_debug.pt"
for="zope.interface.common.interfaces.IException"
class=".exceptions.ExceptionDebugView"
permission="zope.Public"
/>
</zopeConfigure>
=== Added File Zope3/src/zope/app/browser/skins/debug/error_debug.pt ===
<html metal:use-macro="context/@@standard_macros/dialog">
<body>
<div metal:fill-slot="body">
<h3>Error type: <tal:span tal:replace="view/error_type" /></h3>
<h5>Error object: <tal:span tal:replace="view/error_object" /></h5>
<pre class="traceback">
<tal:line tal:repeat="line view/traceback_lines"
tal:replace="line">TRACEBACK LINE</tal:line>
</pre>
</div>
</body>
</html>
=== Added File Zope3/src/zope/app/browser/skins/debug/exceptions.py ===
import sys
import traceback
from zope.interface.common.interfaces import IException
class ExceptionDebugView:
""" Render exceptions for debugging.
"""
__used_for__ = ( IException, )
def __init__( self, context, request ):
self.context = context
self.request = request
self.error_type, self.error_object, tb = sys.exc_info()
try:
self.traceback_lines = traceback.format_tb( tb )
finally:
del tb