Classes | Functions | Variables
pyclearsilver::cgitb Namespace Reference

Classes

class  Frame
class  HiddenObject
class  Hook
class  HTMLFormatter
class  TextFormatter
class  View

Functions

def enable
def reset

Variables

string __author__ = 'Ka-Ping Yee'
list __UNDEF__ = []
string __version__ = '$Revision: 1.10 $'
tuple handler = Hook()
tuple HiddenObject = HiddenObject()

Detailed Description

More comprehensive traceback formatting for Python scripts.

To enable this module, do:

    import cgitb; cgitb.enable()

at the top of your script.  The optional arguments to enable() are:

    display     - if true, tracebacks are displayed in the web browser
    logdir      - if set, tracebacks are written to files in this directory
    context     - number of lines of source code to show for each stack frame
    format      - 'text' or 'html' controls the output format
    viewClass   - sub class of View. Create this if you want to customize the
            layout of the traceback.
    debug       - may be used by viewClass to decide on level of detail

By default, tracebacks are displayed but not saved, the context is 5 lines
and the output format is 'html' (for backwards compatibility with the
original use of this module).

Alternatively, if you have caught an exception and want cgitb to display it
for you, call cgitb.handler().  The optional argument to handler() is a
3-item tuple (etype, evalue, etb) just like the value of sys.exc_info().
The default handler displays output as HTML.


2005-04-22 Nir Soffer <nirs@freeshell.org>

Rewrite:
 - Refactor html and text functions to View class, HTMLFormatter and
   TextFormatter. No more duplicate formating code.
 - Layout is done with minimal html and css, in a way it can't be
   affected by surrounding code.
 - Built to be easy to subclass and modify without duplicating code.
 - Change layout, important details come first.
 - Factor frame analyzing and formatting into separate class.
 - Add debug argument, can be used to change error display e.g. user
   error view, developer error view.
 - Add viewClass argument, make it easy to customize the traceback view.
 - Easy to customize system details and application details.

The main goal of this rewrite was to have a traceback that can render
few tracebacks combined. It's needed when you wrap an expection and want
to print both the traceback up to the wrapper exception, and the
original traceback. There is no code to support this here, but it's easy
to add by using your own View sub class.

Function Documentation

def pyclearsilver.cgitb.enable (   display = 1,
  logdir = None,
  context = 5,
  format = "html",
  viewClass = View,
  debug = 0 
)
Install an exception handler that formats tracebacks as HTML.

The optional argument 'display' can be set to 0 to suppress sending the
traceback to the browser, and 'logdir' can be set to a directory to cause
tracebacks to be written to files there.

Definition at line 611 of file cgitb.py.

Reset the CGI and the browser

Return a string that resets the CGI and browser to a known state.
TODO: probably some of this is not needed any more.

Definition at line 55 of file cgitb.py.


Variable Documentation

string pyclearsilver::cgitb::__author__ = 'Ka-Ping Yee'

Definition at line 49 of file cgitb.py.

Definition at line 70 of file cgitb.py.

string pyclearsilver::cgitb::__version__ = '$Revision: 1.10 $'

Definition at line 50 of file cgitb.py.

Definition at line 609 of file cgitb.py.

Definition at line 76 of file cgitb.py.



pyclearsilver
Author(s): Scott Hassan/hassan@willowgarage.com
autogenerated on Wed Apr 23 2014 10:35:42