Mercurial > cpython-lru_cache-weakref
annotate Doc/lib/libcgitb.tex @ 24042:63fbbed10714 legacy-trunk
Simplify HTTPSConnection constructor.
See discussion in SF bug 458463.
| author | Jeremy Hylton <jeremy@alum.mit.edu> |
|---|---|
| date | Fri, 28 Jun 2002 23:38:14 +0000 |
| parents | a03b13be2f68 |
| children | d1acf89d1c49 |
| rev | line source |
|---|---|
|
21204
f79e4719db96
Documentation for the "cgitb" module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
1 \section{\module{cgitb} --- |
|
f79e4719db96
Documentation for the "cgitb" module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
2 Traceback manager for CGI scripts} |
|
f79e4719db96
Documentation for the "cgitb" module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
3 |
|
f79e4719db96
Documentation for the "cgitb" module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
4 \declaremodule{standard}{cgitb} |
|
f79e4719db96
Documentation for the "cgitb" module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
5 \modulesynopsis{Configurable traceback handler for CGI scripts.} |
|
21466
3a93145b6a96
Merge in Ping's changes to the cgitb documentation, and add a version
Fred Drake <fdrake@acm.org>
parents:
21204
diff
changeset
|
6 \moduleauthor{Ka-Ping Yee}{ping@lfw.org} |
|
21204
f79e4719db96
Documentation for the "cgitb" module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
7 \sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org} |
|
f79e4719db96
Documentation for the "cgitb" module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
8 |
|
21466
3a93145b6a96
Merge in Ping's changes to the cgitb documentation, and add a version
Fred Drake <fdrake@acm.org>
parents:
21204
diff
changeset
|
9 \versionadded{2.2} |
|
3a93145b6a96
Merge in Ping's changes to the cgitb documentation, and add a version
Fred Drake <fdrake@acm.org>
parents:
21204
diff
changeset
|
10 \index{CGI!exceptions} |
|
21204
f79e4719db96
Documentation for the "cgitb" module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
11 \index{CGI!tracebacks} |
|
21504
a03b13be2f68
Re-commit Ping's patch to the cgi and cgitb documentation, using the
Fred Drake <fdrake@acm.org>
parents:
21466
diff
changeset
|
12 \index{exceptions!in CGI scripts} |
|
a03b13be2f68
Re-commit Ping's patch to the cgi and cgitb documentation, using the
Fred Drake <fdrake@acm.org>
parents:
21466
diff
changeset
|
13 \index{tracebacks!in CGI scripts} |
|
21204
f79e4719db96
Documentation for the "cgitb" module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
14 |
|
f79e4719db96
Documentation for the "cgitb" module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
15 The \module{cgitb} module provides a special exception handler for CGI |
|
21504
a03b13be2f68
Re-commit Ping's patch to the cgi and cgitb documentation, using the
Fred Drake <fdrake@acm.org>
parents:
21466
diff
changeset
|
16 scripts. After this module is activated, if an uncaught exception occurs, |
|
a03b13be2f68
Re-commit Ping's patch to the cgi and cgitb documentation, using the
Fred Drake <fdrake@acm.org>
parents:
21466
diff
changeset
|
17 a detailed, formatted report will be sent to the Web browser. The report |
|
a03b13be2f68
Re-commit Ping's patch to the cgi and cgitb documentation, using the
Fred Drake <fdrake@acm.org>
parents:
21466
diff
changeset
|
18 includes a traceback showing excerpts of the source code for each level, |
|
a03b13be2f68
Re-commit Ping's patch to the cgi and cgitb documentation, using the
Fred Drake <fdrake@acm.org>
parents:
21466
diff
changeset
|
19 as well as the values of the arguments and local variables to currently |
|
21466
3a93145b6a96
Merge in Ping's changes to the cgitb documentation, and add a version
Fred Drake <fdrake@acm.org>
parents:
21204
diff
changeset
|
20 running functions, to help you debug the problem. Optionally, you can |
|
3a93145b6a96
Merge in Ping's changes to the cgitb documentation, and add a version
Fred Drake <fdrake@acm.org>
parents:
21204
diff
changeset
|
21 save this information to a file instead of sending it to the browser. |
|
3a93145b6a96
Merge in Ping's changes to the cgitb documentation, and add a version
Fred Drake <fdrake@acm.org>
parents:
21204
diff
changeset
|
22 |
|
3a93145b6a96
Merge in Ping's changes to the cgitb documentation, and add a version
Fred Drake <fdrake@acm.org>
parents:
21204
diff
changeset
|
23 To enable this feature, simply add one line to the top of your CGI script: |
|
3a93145b6a96
Merge in Ping's changes to the cgitb documentation, and add a version
Fred Drake <fdrake@acm.org>
parents:
21204
diff
changeset
|
24 |
|
3a93145b6a96
Merge in Ping's changes to the cgitb documentation, and add a version
Fred Drake <fdrake@acm.org>
parents:
21204
diff
changeset
|
25 \begin{verbatim} |
|
3a93145b6a96
Merge in Ping's changes to the cgitb documentation, and add a version
Fred Drake <fdrake@acm.org>
parents:
21204
diff
changeset
|
26 import cgitb; cgitb.enable() |
|
3a93145b6a96
Merge in Ping's changes to the cgitb documentation, and add a version
Fred Drake <fdrake@acm.org>
parents:
21204
diff
changeset
|
27 \end{verbatim} |
|
3a93145b6a96
Merge in Ping's changes to the cgitb documentation, and add a version
Fred Drake <fdrake@acm.org>
parents:
21204
diff
changeset
|
28 |
|
3a93145b6a96
Merge in Ping's changes to the cgitb documentation, and add a version
Fred Drake <fdrake@acm.org>
parents:
21204
diff
changeset
|
29 The options to the \function{enable()} function control whether the |
|
3a93145b6a96
Merge in Ping's changes to the cgitb documentation, and add a version
Fred Drake <fdrake@acm.org>
parents:
21204
diff
changeset
|
30 report is displayed in the browser and whether the report is logged |
|
3a93145b6a96
Merge in Ping's changes to the cgitb documentation, and add a version
Fred Drake <fdrake@acm.org>
parents:
21204
diff
changeset
|
31 to a file for later analysis. |
|
21204
f79e4719db96
Documentation for the "cgitb" module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
32 |
|
f79e4719db96
Documentation for the "cgitb" module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
33 |
|
f79e4719db96
Documentation for the "cgitb" module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
34 \begin{funcdesc}{enable}{\optional{display\optional{, logdir\optional{, |
|
f79e4719db96
Documentation for the "cgitb" module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
35 context}}}} |
|
f79e4719db96
Documentation for the "cgitb" module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
36 This function causes the \module{cgitb} module to take over the |
|
21466
3a93145b6a96
Merge in Ping's changes to the cgitb documentation, and add a version
Fred Drake <fdrake@acm.org>
parents:
21204
diff
changeset
|
37 interpreter's default handling for exceptions by setting the |
|
21204
f79e4719db96
Documentation for the "cgitb" module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
38 value of \code{\refmodule{sys}.excepthook}. |
|
21466
3a93145b6a96
Merge in Ping's changes to the cgitb documentation, and add a version
Fred Drake <fdrake@acm.org>
parents:
21204
diff
changeset
|
39 \withsubitem{(in module sys)}{\ttindex{excepthook()}} |
|
21204
f79e4719db96
Documentation for the "cgitb" module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
40 |
|
21466
3a93145b6a96
Merge in Ping's changes to the cgitb documentation, and add a version
Fred Drake <fdrake@acm.org>
parents:
21204
diff
changeset
|
41 The optional argument \var{display} defaults to \code{1} and can be set |
|
3a93145b6a96
Merge in Ping's changes to the cgitb documentation, and add a version
Fred Drake <fdrake@acm.org>
parents:
21204
diff
changeset
|
42 to \code{0} to suppress sending the traceback to the browser. |
|
3a93145b6a96
Merge in Ping's changes to the cgitb documentation, and add a version
Fred Drake <fdrake@acm.org>
parents:
21204
diff
changeset
|
43 If the argument \var{logdir} is present, the traceback reports are |
|
3a93145b6a96
Merge in Ping's changes to the cgitb documentation, and add a version
Fred Drake <fdrake@acm.org>
parents:
21204
diff
changeset
|
44 written to files. The value of \var{logdir} should be a directory |
|
3a93145b6a96
Merge in Ping's changes to the cgitb documentation, and add a version
Fred Drake <fdrake@acm.org>
parents:
21204
diff
changeset
|
45 where these files will be placed. |
|
3a93145b6a96
Merge in Ping's changes to the cgitb documentation, and add a version
Fred Drake <fdrake@acm.org>
parents:
21204
diff
changeset
|
46 The optional argument \var{context} is the number of lines of |
|
3a93145b6a96
Merge in Ping's changes to the cgitb documentation, and add a version
Fred Drake <fdrake@acm.org>
parents:
21204
diff
changeset
|
47 context to display around the current line of source code in the |
|
3a93145b6a96
Merge in Ping's changes to the cgitb documentation, and add a version
Fred Drake <fdrake@acm.org>
parents:
21204
diff
changeset
|
48 traceback; this defaults to \code{5}. |
|
21204
f79e4719db96
Documentation for the "cgitb" module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
49 \end{funcdesc} |
|
f79e4719db96
Documentation for the "cgitb" module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
50 |
|
f79e4719db96
Documentation for the "cgitb" module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
51 \begin{funcdesc}{handler}{\optional{info}} |
|
21466
3a93145b6a96
Merge in Ping's changes to the cgitb documentation, and add a version
Fred Drake <fdrake@acm.org>
parents:
21204
diff
changeset
|
52 This function handles an exception using the default settings |
|
3a93145b6a96
Merge in Ping's changes to the cgitb documentation, and add a version
Fred Drake <fdrake@acm.org>
parents:
21204
diff
changeset
|
53 (that is, show a report in the browser, but don't log to a file). |
|
3a93145b6a96
Merge in Ping's changes to the cgitb documentation, and add a version
Fred Drake <fdrake@acm.org>
parents:
21204
diff
changeset
|
54 This can be used when you've caught an exception and want to |
|
3a93145b6a96
Merge in Ping's changes to the cgitb documentation, and add a version
Fred Drake <fdrake@acm.org>
parents:
21204
diff
changeset
|
55 report it using \module{cgitb}. The optional \var{info} argument |
|
3a93145b6a96
Merge in Ping's changes to the cgitb documentation, and add a version
Fred Drake <fdrake@acm.org>
parents:
21204
diff
changeset
|
56 should be a 3-tuple containing an exception type, exception |
|
3a93145b6a96
Merge in Ping's changes to the cgitb documentation, and add a version
Fred Drake <fdrake@acm.org>
parents:
21204
diff
changeset
|
57 value, and traceback object, exactly like the tuple returned by |
|
3a93145b6a96
Merge in Ping's changes to the cgitb documentation, and add a version
Fred Drake <fdrake@acm.org>
parents:
21204
diff
changeset
|
58 \code{\refmodule{sys}.exc_info()}. If the \var{info} argument |
|
3a93145b6a96
Merge in Ping's changes to the cgitb documentation, and add a version
Fred Drake <fdrake@acm.org>
parents:
21204
diff
changeset
|
59 is not supplied, the current exception is obtained from |
|
3a93145b6a96
Merge in Ping's changes to the cgitb documentation, and add a version
Fred Drake <fdrake@acm.org>
parents:
21204
diff
changeset
|
60 \code{\refmodule{sys}.exc_info()}. |
|
21204
f79e4719db96
Documentation for the "cgitb" module.
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
61 \end{funcdesc} |
