~ubuntu-branches/ubuntu/karmic/libapache2-mod-python/karmic-updates

« back to all changes in this revision

Viewing changes to doc-html/pyapi-apmeth.html

  • Committer: Bazaar Package Importer
  • Author(s): Piotr Ozarowski
  • Date: 2007-02-21 18:24:29 UTC
  • mfrom: (1.1.8 feisty)
  • Revision ID: james.westby@ubuntu.com-20070221182429-9okop7e0qpi24l85
Tags: 3.2.10-4
* Added XS-Vcs-Svn field
* Removed "db_purge" part from libapache2-mod-python.postrm
  (dh_installdebconf is generating a rule that will not fail if debconf is
  already removed)
* Added initial Spanish debconf translation from Manuel Porras Peralta.
  (closes: #411235)
* Added initial Portuguese debconf translation from Pedro Ribeiro.
  (closes: #411742)
* Added initial Galician debconf translation from Jacobo Tarrio.
  (closes: #411831)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2
2
<html>
3
3
<head>
4
 
<title>4.5.1 Functions</title>
5
 
<META NAME="description" CONTENT="4.5.1 Functions">
 
4
<link rel="STYLESHEET" href="modpython.css" type='text/css'>
 
5
<link rel="first" href="modpython.html" title='Mod_python Manual'>
 
6
<link rel='contents' href='contents.html' title="Contents">
 
7
<link rel='index' href='genindex.html' title='Index'>
 
8
<link rel='last' href='about.html' title='About this document...'>
 
9
<link rel='help' href='about.html' title='About this document...'>
 
10
<LINK REL="next" href="pyapi-mptable.html">
 
11
<LINK REL="prev" href="module-apache.html">
 
12
<LINK REL="parent" href="module-apache.html">
 
13
<LINK REL="next" href="pyapi-mptable.html">
 
14
<meta name='aesop' content='information'>
 
15
<META NAME="description" CONTENT="Functions">
6
16
<META NAME="keywords" CONTENT="modpython">
7
17
<META NAME="resource-type" CONTENT="document">
8
18
<META NAME="distribution" CONTENT="global">
9
 
<link rel="STYLESHEET" href="modpython.css">
10
 
<link rel="first" href="modpython.html">
11
 
<link rel="contents" href="contents.html" title="Contents">
12
 
<link rel="index" href="genindex.html" title="Index">
13
 
<LINK REL="next" href="pyapi-mptable.html">
14
 
<LINK REL="previous" href="module-apache.html">
15
 
<LINK REL="up" href="module-apache.html">
16
 
<LINK REL="next" href="pyapi-mptable.html">
 
19
<title>4.5.1 Functions</title>
17
20
</head>
18
21
<body>
19
22
<DIV CLASS="navigation">
20
23
<table align="center" width="100%" cellpadding="0" cellspacing="2">
21
24
<tr>
22
 
<td><A href="module-apache.html"><img src="icons/previous.gif"
23
 
  border="0" height="32"
24
 
  alt="Previous Page" width="32"></A></td>
25
 
<td><A href="module-apache.html"><img src="icons/up.gif"
26
 
  border="0" height="32"
27
 
  alt="Up One Level" width="32"></A></td>
28
 
<td><A href="pyapi-mptable.html"><img src="icons/next.gif"
29
 
  border="0" height="32"
30
 
  alt="Next Page" width="32"></A></td>
 
25
<td><a rel="prev" title="4.5 apache - Access" 
 
26
  href="module-apache.html"><img src='previous.gif'
 
27
  border='0' height='32'  alt='Previous Page' width='32'></A></td>
 
28
<td><a rel="parent" title="4.5 apache - Access" 
 
29
  href="module-apache.html"><img src='up.gif'
 
30
  border='0' height='32'  alt='Up One Level' width='32'></A></td>
 
31
<td><a rel="next" title="4.5.2 Table Object (mp_table)&nbsp;" 
 
32
  href="pyapi-mptable.html"><img src='next.gif'
 
33
  border='0' height='32'  alt='Next Page' width='32'></A></td>
31
34
<td align="center" width="100%">Mod_python Manual</td>
32
 
<td><A href="contents.html"><img src="icons/contents.gif"
33
 
  border="0" height="32"
34
 
  alt="Contents" width="32"></A></td>
35
 
<td><img src="icons/blank.gif"
36
 
  border="0" height="32"
37
 
  alt="" width="32"></td>
38
 
<td><A href="genindex.html"><img src="icons/index.gif"
39
 
  border="0" height="32"
40
 
  alt="Index" width="32"></A></td>
 
35
<td><a rel="contents" title="Table of Contents" 
 
36
  href="contents.html"><img src='contents.gif'
 
37
  border='0' height='32'  alt='Contents' width='32'></A></td>
 
38
<td><img src='blank.gif'
 
39
  border='0' height='32'  alt='' width='32'></td>
 
40
<td><a rel="index" title="Index" 
 
41
  href="genindex.html"><img src='index.gif'
 
42
  border='0' height='32'  alt='Index' width='32'></A></td>
41
43
</tr></table>
42
 
<b class="navlabel">Previous:</b> <a class="sectref" href="module-apache.html">4.5 apache - Access</A>
43
 
<b class="navlabel">Up:</b> <a class="sectref" href="module-apache.html">4.5 apache - Access</A>
44
 
<b class="navlabel">Next:</b> <a class="sectref" href="pyapi-mptable.html">4.5.2 Table Object (mp_table)&nbsp;</A>
 
44
<b class="navlabel">Previous:</b>
 
45
<a class="sectref" rel="prev" href="module-apache.html">4.5 apache - Access</A>
 
46
<b class="navlabel">Up:</b>
 
47
<a class="sectref" rel="parent" href="module-apache.html">4.5 apache - Access</A>
 
48
<b class="navlabel">Next:</b>
 
49
<a class="sectref" rel="next" href="pyapi-mptable.html">4.5.2 Table Object (mp_table)&nbsp;</A>
45
50
<br><hr>
46
51
</DIV>
47
52
<!--End of Navigation Panel-->
52
57
</H2>
53
58
 
54
59
<P>
55
 
<dl><dt><b><a name="l2h-19"><tt class="function">log_error</tt></a></b>(<var>message</var><big>[</big><var>, level, server</var><big>]</big>)
 
60
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
 
61
  <td><nobr><b><a name="l2h-31"><tt class="function">log_error</tt></a></b>(</nobr></td>
 
62
  <td><var>message</var><big>[</big><var>, level, server</var><big>]</big>)</td></tr></table>
56
63
<dd>
57
64
  An interface to the Apache <code>ap_log_error()</code>
58
65
  function. <var>message</var> is a string with the error message,
59
66
  <var>level</var> is one of the following flags constants:
60
67
 
61
68
<P>
62
 
<dl><dd><pre class="verbatim">
 
69
<div class="verbatim"><pre>
63
70
    APLOG_EMERG
64
71
    APLOG_ALERT
65
72
    APLOG_CRIT
69
76
    APLOG_INFO
70
77
    APLOG_DEBUG
71
78
    APLOG_NOERRNO
72
 
</pre></dl>            
 
79
</pre></div>            
73
80
 
74
81
<P>
75
82
<var>server</var> is a reference to a <tt class="member">req.server</tt> object. If
86
93
</dl>
87
94
 
88
95
<P>
89
 
<dl><dt><b><a name="l2h-20"><tt class="function">import_module</tt></a></b>(<var>module_name</var><big>[</big><var>, autoreload=1, log=0, path=None</var><big>]</big>)
 
96
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
 
97
  <td><nobr><b><a name="l2h-32"><tt class="function">import_module</tt></a></b>(</nobr></td>
 
98
  <td><var>module_name</var><big>[</big><var>, autoreload=1, log=0, path=None</var><big>]</big>)</td></tr></table>
90
99
<dd>
91
100
  This function can be used to import modules taking advantage of
92
101
  mod_python's internal mechanism which reloads modules automatically
104
113
Example:
105
114
 
106
115
<P>
107
 
<dl><dd><pre class="verbatim">
 
116
<div class="verbatim"><pre>
108
117
    from mod_python import apache
109
118
    mymodule = apache.import_module('mymodule', log=1)
110
 
</pre></dl>
 
119
</pre></div>
111
120
</dl>
112
121
 
113
122
<P>
114
 
<dl><dt><b><a name="l2h-21"><tt class="function">allow_methods</tt></a></b>(<big>[</big><var>*args</var><big>]</big>)
 
123
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
 
124
  <td><nobr><b><a name="l2h-33"><tt class="function">allow_methods</tt></a></b>(</nobr></td>
 
125
  <td><big>[</big><var>*args</var><big>]</big>)</td></tr></table>
115
126
<dd>
116
127
  A convenience function to set values in <tt class="member">req.allowed</tt>.
117
128
  <tt class="member">req.allowed</tt> is a bitmask that is used to construct the
120
131
 
121
132
<P>
122
133
Arguments can be one or more of the following:
123
 
  <dl><dd><pre class="verbatim">
 
134
  <div class="verbatim"><pre>
124
135
    M_GET
125
136
    M_PUT
126
137
    M_POST
148
159
    M_BASELINE_CONTROL
149
160
    M_MERGE
150
161
    M_INVALID
151
 
</pre></dl>
152
 
 
153
 
<P>
154
 
</dl>
155
 
 
156
 
<P>
157
 
<dl><dt><b><a name="l2h-22"><tt class="function">config_tree</tt></a></b>()
 
162
</pre></div>
 
163
 
 
164
<P>
 
165
</dl>
 
166
 
 
167
<P>
 
168
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
 
169
  <td><nobr><b><a name="l2h-34"><tt class="function">exists_config_define</tt></a></b>(</nobr></td>
 
170
  <td><var>name</var>)</td></tr></table>
 
171
<dd>
 
172
    This function returns True if the Apache server was launched
 
173
    with the definition with the given <var>name</var>. This means
 
174
    that you can test whether Apache was launched with the <code>-DFOOBAR</code>
 
175
    parameter by calling <code>apache.exists_config_define('FOOBAR')</code>.
 
176
</dl>
 
177
 
 
178
<P>
 
179
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
 
180
  <td><nobr><b><a name="l2h-35"><tt class="method">register_cleanup</tt></a></b>(</nobr></td>
 
181
  <td><var>handler</var><big>[</big><var>, data</var><big>]</big>)</td></tr></table>
 
182
<dd>
 
183
  Registers a cleanup. Equivalent to <tt class="function">req.register_cleanup()</tt>
 
184
  or <tt class="function">req.server.register_cleanup()</tt>, except that a server or request
 
185
  object is not required.
 
186
</dl>
 
187
 
 
188
<P>
 
189
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
 
190
  <td><nobr><b><a name="l2h-36"><tt class="function">config_tree</tt></a></b>(</nobr></td>
 
191
  <td>)</td></tr></table>
158
192
<dd>
159
193
  Returns the server-level configuration tree. This tree does not
160
194
  include directives from .htaccess files. This is a <i>copy</i> of
162
196
</dl>
163
197
 
164
198
<P>
165
 
<dl><dt><b><a name="l2h-23"><tt class="function">server_root</tt></a></b>()
 
199
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
 
200
  <td><nobr><b><a name="l2h-37"><tt class="function">server_root</tt></a></b>(</nobr></td>
 
201
  <td>)</td></tr></table>
166
202
<dd>
167
203
  Returns the value of ServerRoot.
168
204
</dl>
169
205
 
170
206
<P>
171
 
<dl><dt><b><a name="l2h-24"><tt class="function">make_table</tt></a></b>()
 
207
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
 
208
  <td><nobr><b><a name="l2h-38"><tt class="function">make_table</tt></a></b>(</nobr></td>
 
209
  <td>)</td></tr></table>
172
210
<dd> 
173
211
  This function is obsolete and is an alias to <tt class="class">table</tt> (see below).
174
212
</dl>
175
213
 
176
214
<P>
177
 
<dl><dt><b><a name="l2h-25"><tt class="function">mpm_query</tt></a></b>(<var>code</var>)
 
215
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
 
216
  <td><nobr><b><a name="l2h-39"><tt class="function">mpm_query</tt></a></b>(</nobr></td>
 
217
  <td><var>code</var>)</td></tr></table>
178
218
<dd>
179
219
  Allows querying of the MPM for various parameters such as numbers of
180
220
  processes and threads. The return value is one of three constants:
181
 
  <dl><dd><pre class="verbatim">
 
221
  <div class="verbatim"><pre>
182
222
AP_MPMQ_NOT_SUPPORTED      = 0  # This value specifies whether 
183
223
                                # an MPM is capable of         
184
224
                                # threading or forking.        
188
228
AP_MPMQ_DYNAMIC            = 2  # This value specifies whether 
189
229
                                # an MPM is using a dynamic # of
190
230
                                # threads or daemons.
191
 
</pre></dl>
 
231
</pre></div>
192
232
 
193
233
<P>
194
234
The <var>code</var> argument must be one of the following:
195
 
  <dl><dd><pre class="verbatim">
 
235
  <div class="verbatim"><pre>
196
236
AP_MPMQ_MAX_DAEMON_USED    = 1  # Max # of daemons used so far 
197
237
AP_MPMQ_IS_THREADED        = 2  # MPM can do threading         
198
238
AP_MPMQ_IS_FORKED          = 3  # MPM can do forking           
205
245
AP_MPMQ_MAX_SPARE_THREADS  = 10 # Max # of spare threads       
206
246
AP_MPMQ_MAX_REQUESTS_DAEMON= 11 # Max # of requests per daemon 
207
247
AP_MPMQ_MAX_DAEMONS        = 12 # Max # of daemons by config
208
 
</pre></dl>
 
248
</pre></div>
209
249
 
210
250
<P>
211
251
Example:
212
 
  <dl><dd><pre class="verbatim">
 
252
  <div class="verbatim"><pre>
213
253
if apache.mpm_query(apache.AP_MPMQ_IS_THREADED):
214
254
    # do something
215
255
else:
216
256
    # do something else
217
 
</pre></dl>
 
257
</pre></div>
218
258
</dl>
219
259
 
220
260
<P>
223
263
<p><hr>
224
264
<table align="center" width="100%" cellpadding="0" cellspacing="2">
225
265
<tr>
226
 
<td><A href="module-apache.html"><img src="icons/previous.gif"
227
 
  border="0" height="32"
228
 
  alt="Previous Page" width="32"></A></td>
229
 
<td><A href="module-apache.html"><img src="icons/up.gif"
230
 
  border="0" height="32"
231
 
  alt="Up One Level" width="32"></A></td>
232
 
<td><A href="pyapi-mptable.html"><img src="icons/next.gif"
233
 
  border="0" height="32"
234
 
  alt="Next Page" width="32"></A></td>
 
266
<td><a rel="prev" title="4.5 apache - Access" 
 
267
  rel="prev" title="4.5 apache - Access" 
 
268
  href="module-apache.html"><img src='previous.gif'
 
269
  border='0' height='32'  alt='Previous Page' width='32'></A></td>
 
270
<td><a rel="parent" title="4.5 apache - Access" 
 
271
  rel="parent" title="4.5 apache - Access" 
 
272
  href="module-apache.html"><img src='up.gif'
 
273
  border='0' height='32'  alt='Up One Level' width='32'></A></td>
 
274
<td><a rel="next" title="4.5.2 Table Object (mp_table)&nbsp;" 
 
275
  rel="next" title="4.5.2 Table Object (mp_table)&nbsp;" 
 
276
  href="pyapi-mptable.html"><img src='next.gif'
 
277
  border='0' height='32'  alt='Next Page' width='32'></A></td>
235
278
<td align="center" width="100%">Mod_python Manual</td>
236
 
<td><A href="contents.html"><img src="icons/contents.gif"
237
 
  border="0" height="32"
238
 
  alt="Contents" width="32"></A></td>
239
 
<td><img src="icons/blank.gif"
240
 
  border="0" height="32"
241
 
  alt="" width="32"></td>
242
 
<td><A href="genindex.html"><img src="icons/index.gif"
243
 
  border="0" height="32"
244
 
  alt="Index" width="32"></A></td>
 
279
<td><a rel="contents" title="Table of Contents" 
 
280
  rel="contents" title="Table of Contents" 
 
281
  href="contents.html"><img src='contents.gif'
 
282
  border='0' height='32'  alt='Contents' width='32'></A></td>
 
283
<td><img src='blank.gif'
 
284
  border='0' height='32'  alt='' width='32'></td>
 
285
<td><a rel="index" title="Index" 
 
286
  rel="index" title="Index" 
 
287
  href="genindex.html"><img src='index.gif'
 
288
  border='0' height='32'  alt='Index' width='32'></A></td>
245
289
</tr></table>
246
 
<b class="navlabel">Previous:</b> <a class="sectref" href="module-apache.html">4.5 apache - Access</A>
247
 
<b class="navlabel">Up:</b> <a class="sectref" href="module-apache.html">4.5 apache - Access</A>
248
 
<b class="navlabel">Next:</b> <a class="sectref" href="pyapi-mptable.html">4.5.2 Table Object (mp_table)&nbsp;</A>
 
290
<b class="navlabel">Previous:</b>
 
291
<a class="sectref" rel="prev" href="module-apache.html">4.5 apache - Access</A>
 
292
<b class="navlabel">Up:</b>
 
293
<a class="sectref" rel="parent" href="module-apache.html">4.5 apache - Access</A>
 
294
<b class="navlabel">Next:</b>
 
295
<a class="sectref" rel="next" href="pyapi-mptable.html">4.5.2 Table Object (mp_table)&nbsp;</A>
249
296
<hr>
250
 
<span class="release-info">Release 3.1.3, documentation updated on February 17, 2004.</span>
 
297
<span class="release-info">Release 3.2.10, documentation updated on July 19, 2006.</span>
251
298
</DIV>
252
299
<!--End of Navigation Panel-->
253
300