~ubuntu-branches/ubuntu/gutsy/libapache2-mod-python/gutsy

« back to all changes in this revision

Viewing changes to doc-html/pyapi-mprequest-meth.html

  • Committer: Bazaar Package Importer
  • Author(s): Piotr Ożarowski
  • Date: 2007-04-12 20:52:05 UTC
  • mfrom: (1.2.4 upstream) (1.1.2 etch)
  • Revision ID: james.westby@ubuntu.com-20070412205205-j4qlsw3o4tl615iq
Tags: 3.3.1-1
* New upstream release
* Remove configure and mod_python.h files in clean rule to make the diff.gz
  file smaller
* Current Python version in libapache2-mod-pythonX.Y package name (Provides:
  field) filled in automatically.
* Added XS-Vcs-Browser field

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
 
<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-mprequest-mem.html">
11
 
<LINK REL="prev" href="pyapi-mprequest.html">
12
 
<LINK REL="parent" href="pyapi-mprequest.html">
13
 
<LINK REL="next" href="pyapi-mprequest-mem.html">
14
 
<meta name='aesop' content='information'>
15
 
<META NAME="description" CONTENT="Request Methods">
16
 
<META NAME="keywords" CONTENT="modpython">
17
 
<META NAME="resource-type" CONTENT="document">
18
 
<META NAME="distribution" CONTENT="global">
19
 
<title>4.5.3.1 Request Methods</title>
 
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-mprequest-mem.html" />
 
11
<link rel="prev" href="pyapi-mprequest.html" />
 
12
<link rel="parent" href="pyapi-mprequest.html" />
 
13
<link rel="next" href="pyapi-mprequest-mem.html" />
 
14
<meta name='aesop' content='information' />
 
15
<title>4.5.4.1 Request Methods</title>
20
16
</head>
21
17
<body>
22
18
<DIV CLASS="navigation">
 
19
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
23
20
<table align="center" width="100%" cellpadding="0" cellspacing="2">
24
21
<tr>
25
 
<td><a rel="prev" title="4.5.3 Request Object&nbsp;" 
26
 
  href="pyapi-mprequest.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.3 Request Object&nbsp;" 
29
 
  href="pyapi-mprequest.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.3.2 Request Members" 
32
 
  href="pyapi-mprequest-mem.html"><img src='next.gif'
33
 
  border='0' height='32'  alt='Next Page' width='32'></A></td>
 
22
<td class='online-navigation'><a rel="prev" title="4.5.4 Request Object"
 
23
  href="pyapi-mprequest.html"><img src='previous.png'
 
24
  border='0' height='32'  alt='Previous Page' width='32' /></A></td>
 
25
<td class='online-navigation'><a rel="parent" title="4.5.4 Request Object"
 
26
  href="pyapi-mprequest.html"><img src='up.png'
 
27
  border='0' height='32'  alt='Up One Level' width='32' /></A></td>
 
28
<td class='online-navigation'><a rel="next" title="4.5.4.2 Request Members"
 
29
  href="pyapi-mprequest-mem.html"><img src='next.png'
 
30
  border='0' height='32'  alt='Next Page' width='32' /></A></td>
34
31
<td align="center" width="100%">Mod_python Manual</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>
 
32
<td class='online-navigation'><a rel="contents" title="Table of Contents"
 
33
  href="contents.html"><img src='contents.png'
 
34
  border='0' height='32'  alt='Contents' width='32' /></A></td>
 
35
<td class='online-navigation'><img src='blank.png'
 
36
  border='0' height='32'  alt='' width='32' /></td>
 
37
<td class='online-navigation'><a rel="index" title="Index"
 
38
  href="genindex.html"><img src='index.png'
 
39
  border='0' height='32'  alt='Index' width='32' /></A></td>
43
40
</tr></table>
 
41
<div class='online-navigation'>
44
42
<b class="navlabel">Previous:</b>
45
 
<a class="sectref" rel="prev" href="pyapi-mprequest.html">4.5.3 Request Object&nbsp;</A>
 
43
<a class="sectref" rel="prev" href="pyapi-mprequest.html">4.5.4 Request Object</A>
46
44
<b class="navlabel">Up:</b>
47
 
<a class="sectref" rel="parent" href="pyapi-mprequest.html">4.5.3 Request Object&nbsp;</A>
 
45
<a class="sectref" rel="parent" href="pyapi-mprequest.html">4.5.4 Request Object</A>
48
46
<b class="navlabel">Next:</b>
49
 
<a class="sectref" rel="next" href="pyapi-mprequest-mem.html">4.5.3.2 Request Members</A>
50
 
<br><hr>
 
47
<a class="sectref" rel="next" href="pyapi-mprequest-mem.html">4.5.4.2 Request Members</A>
 
48
</div>
 
49
<hr /></div>
51
50
</DIV>
52
51
<!--End of Navigation Panel-->
53
52
 
54
 
<H3><A NAME="SECTION006531000000000000000">&nbsp;</A>
 
53
<H3><A NAME="SECTION006541000000000000000"></A><A NAME="pyapi-mprequest-meth"></A>
55
54
<BR>
56
 
4.5.3.1 Request Methods
 
55
4.5.4.1 Request Methods
57
56
</H3>
58
57
 
59
58
<P>
60
59
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
61
 
  <td><nobr><b><a name="l2h-45"><tt class="method">add_common_vars</tt></a></b>(</nobr></td>
62
 
  <td>)</td></tr></table>
 
60
  <td><nobr><b><tt id='l2h-48' xml:id='l2h-48' class="method">add_common_vars</tt></b>(</nobr></td>
 
61
  <td><var></var>)</td></tr></table></dt>
63
62
<dd>
64
63
  Calls the Apache <tt class="cfunction">ap_add_common_vars()</tt> function. After a
65
64
  call to this method, <tt class="member">req.subprocess_env</tt> will contain a
68
67
 
69
68
<P>
70
69
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
71
 
  <td><nobr><b><a name="l2h-46"><tt class="method">add_handler</tt></a></b>(</nobr></td>
72
 
  <td><var>htype, handler</var><big>[</big><var>, dir</var><big>]</big>)</td></tr></table>
 
70
  <td><nobr><b><tt id='l2h-49' xml:id='l2h-49' class="method">add_handler</tt></b>(</nobr></td>
 
71
  <td><var>htype, handler</var><big>[</big><var>, dir</var><big>]</big><var></var>)</td></tr></table></dt>
73
72
<dd>
74
73
 
75
74
<P>
77
76
  containing the name of any of the apache request (but not filter or
78
77
  connection) handler directives,
79
78
  e.g. "<tt class="samp">PythonHandler</tt>". <var>handler</var> is a string containing the
80
 
  name of the module and the handler function.  Optional <var>dir</var> is
81
 
  a string containing the name of the directory to be added to the
82
 
  pythonpath. If no directory is specified, then, if there is already
83
 
  a handler of the same type specified, its directory is inherited,
84
 
  otherwise the directory of the presently executing handler is
85
 
  used. If there is a <code>PythonPath</code> directive in effect, then
86
 
  <code>sys.path</code> will be set exactly according to it (no directories
87
 
  added, the <var>dir</var> argument is ignored).
 
79
  name of the module and the handler function, or the callable object
 
80
  itself. Optional <var>dir</var> is a string containing the name of the
 
81
  directory to be added to the module search path when looking for the
 
82
  handler. If no directory is specified, then the directory to search
 
83
  in is inherited from the handler which is making the registration,
88
84
 
89
85
<P>
90
86
A handler added this way only persists throughout the life of the
91
87
  request. It is possible to register more handlers while inside the
92
 
  handler of the same type. One has to be careful as to not to create
93
 
  an infinite loop this way.
 
88
  handler of the same type. One has to be careful as to not to create an
 
89
  infinite loop this way.
94
90
 
95
91
<P>
96
92
Dynamic handler registration is a useful technique that allows the
112
108
If you pass this function an invalid handler, an exception will be
113
109
    generated at the time an attempt is made to find the handler. 
114
110
  </div>
115
 
</dl>
116
 
 
117
 
<P>
118
 
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
119
 
  <td><nobr><b><a name="l2h-47"><tt class="method">allow_methods</tt></a></b>(</nobr></td>
120
 
  <td><var>methods</var><big>[</big><var>, reset</var><big>]</big>)</td></tr></table>
 
111
 
 
112
<P>
 
113
</dl>
 
114
 
 
115
<P>
 
116
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
 
117
  <td><nobr><b><tt id='l2h-50' xml:id='l2h-50' class="method">add_input_filter</tt></b>(</nobr></td>
 
118
  <td><var>filter_name</var>)</td></tr></table></dt>
 
119
<dd>
 
120
  Adds the named filter into the input filter chain for the current request.
 
121
  The filter should be added before the first attempt to read any data from
 
122
  the request.
 
123
</dl>
 
124
 
 
125
<P>
 
126
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
 
127
  <td><nobr><b><tt id='l2h-51' xml:id='l2h-51' class="method">add_output_filter</tt></b>(</nobr></td>
 
128
  <td><var>filter_name</var>)</td></tr></table></dt>
 
129
<dd>
 
130
  Adds the named filter into the output filter chain for the current request.
 
131
  The filter should be added before the first attempt to write any data for
 
132
  the response.
 
133
 
 
134
<P>
 
135
Provided that all data written is being buffered and not flushed, this
 
136
  could be used to add the "CONTENT_LENGTH" filter into the chain of
 
137
  output filters. The purpose of the "CONTENT_LENGTH" filter is to add a
 
138
  <code>Content-Length:</code> header to the response.
 
139
 
 
140
<P>
 
141
<div class="verbatim"><pre>
 
142
    req.add_output_filter("CONTENT_LENGTH")
 
143
    req.write("content",0)
 
144
</pre></div>                              
 
145
 
 
146
<P>
 
147
</dl>
 
148
 
 
149
<P>
 
150
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
 
151
  <td><nobr><b><tt id='l2h-52' xml:id='l2h-52' class="method">allow_methods</tt></b>(</nobr></td>
 
152
  <td><var>methods</var><big>[</big><var>, reset</var><big>]</big><var></var>)</td></tr></table></dt>
121
153
<dd>
122
154
  Adds methods to the <tt class="member">req.allowed_methods</tt> list. This list
123
155
  will be passed in <code>Allowed:</code> header if
134
166
 
135
167
<P>
136
168
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
137
 
  <td><nobr><b><a name="l2h-48"><tt class="method">document_root</tt></a></b>(</nobr></td>
138
 
  <td>)</td></tr></table>
 
169
  <td><nobr><b><tt id='l2h-53' xml:id='l2h-53' class="method">auth_name</tt></b>(</nobr></td>
 
170
  <td><var></var>)</td></tr></table></dt>
 
171
<dd>
 
172
  Returns AuthName setting.
 
173
</dl>
 
174
 
 
175
<P>
 
176
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
 
177
  <td><nobr><b><tt id='l2h-54' xml:id='l2h-54' class="method">auth_type</tt></b>(</nobr></td>
 
178
  <td><var></var>)</td></tr></table></dt>
 
179
<dd>
 
180
  Returns AuthType setting.
 
181
</dl>
 
182
 
 
183
<P>
 
184
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
 
185
  <td><nobr><b><tt id='l2h-55' xml:id='l2h-55' class="method">construct_url</tt></b>(</nobr></td>
 
186
  <td><var>uri</var>)</td></tr></table></dt>
 
187
<dd>
 
188
  This function returns a fully qualified URI string from the path specified
 
189
  by uri, using the information stored in the request to determine the scheme,
 
190
  server name and port. The port number is not included in the string if it
 
191
  is the same as the default port 80.
 
192
 
 
193
<P>
 
194
For example, imagine that the current request is directed to the virtual
 
195
  server www.modpython.org at port 80. Then supplying "<tt class="samp">/index.html</tt>" will
 
196
  yield the string "<tt class="samp">http://www.modpython.org/index.html</tt>".
 
197
 
 
198
<P>
 
199
</dl>
 
200
 
 
201
<P>
 
202
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
 
203
  <td><nobr><b><tt id='l2h-56' xml:id='l2h-56' class="method">discard_request_body</tt></b>(</nobr></td>
 
204
  <td><var></var>)</td></tr></table></dt>
 
205
<dd>
 
206
  Tests for and reads any message body in the request, simply discarding
 
207
  whatever it receives.
 
208
</dl>
 
209
 
 
210
<P>
 
211
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
 
212
  <td><nobr><b><tt id='l2h-57' xml:id='l2h-57' class="method">document_root</tt></b>(</nobr></td>
 
213
  <td><var></var>)</td></tr></table></dt>
139
214
<dd>
140
215
  Returns DocumentRoot setting.
141
216
</dl>
142
217
 
143
218
<P>
144
219
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
145
 
  <td><nobr><b><a name="l2h-49"><tt class="method">get_basic_auth_pw</tt></a></b>(</nobr></td>
146
 
  <td>)</td></tr></table>
 
220
  <td><nobr><b><tt id='l2h-58' xml:id='l2h-58' class="method">get_basic_auth_pw</tt></b>(</nobr></td>
 
221
  <td><var></var>)</td></tr></table></dt>
147
222
<dd>
148
223
  Returns a string containing the password when Basic authentication is
149
224
  used.
151
226
 
152
227
<P>
153
228
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
154
 
  <td><nobr><b><a name="l2h-50"><tt class="method">get_config</tt></a></b>(</nobr></td>
155
 
  <td>)</td></tr></table>
 
229
  <td><nobr><b><tt id='l2h-59' xml:id='l2h-59' class="method">get_config</tt></b>(</nobr></td>
 
230
  <td><var></var>)</td></tr></table></dt>
156
231
<dd>
157
232
  Returns a reference to the table object containing the mod_python
158
233
  configuration in effect for this request except for
163
238
 
164
239
<P>
165
240
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
166
 
  <td><nobr><b><a name="l2h-51"><tt class="method">get_remote_host</tt></a></b>(</nobr></td>
167
 
  <td><big>[</big><var>type, str_is_ip</var><big>]</big>)</td></tr></table>
 
241
  <td><nobr><b><tt id='l2h-60' xml:id='l2h-60' class="method">get_remote_host</tt></b>(</nobr></td>
 
242
  <td><var></var><big>[</big><var>type, str_is_ip</var><big>]</big><var></var>)</td></tr></table></dt>
168
243
<dd>
169
244
 
170
245
<P>
184
259
 
185
260
<P>
186
261
</LI>
187
 
<LI><code>apache.REMOTE_NAME</code> <i>(Default)</i> Return the DNS name if
 
262
<LI><code>apache.REMOTE_NAME</code> <em>(Default)</em> Return the DNS name if
188
263
    possible, or the IP (as a string in dotted decimal notation)
189
264
    otherwise.
190
265
 
220
295
 
221
296
<P>
222
297
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
223
 
  <td><nobr><b><a name="l2h-52"><tt class="method">get_options</tt></a></b>(</nobr></td>
224
 
  <td>)</td></tr></table>
 
298
  <td><nobr><b><tt id='l2h-61' xml:id='l2h-61' class="method">get_options</tt></b>(</nobr></td>
 
299
  <td><var></var>)</td></tr></table></dt>
225
300
<dd>
226
301
  Returns a reference to the table object containing the options set by
227
302
  the <code>PythonOption</code> directives.
229
304
 
230
305
<P>
231
306
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
232
 
  <td><nobr><b><a name="l2h-53"><tt class="method">internal_redirect</tt></a></b>(</nobr></td>
233
 
  <td><var>new_uri</var>)</td></tr></table>
 
307
  <td><nobr><b><tt id='l2h-62' xml:id='l2h-62' class="method">internal_redirect</tt></b>(</nobr></td>
 
308
  <td><var>new_uri</var>)</td></tr></table></dt>
234
309
<dd>
235
310
  Internally redirects the request to the <var>new_uri</var>. <var>new_uri</var>
236
311
  must be a string.
246
321
 
247
322
<P>
248
323
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
249
 
  <td><nobr><b><a name="l2h-54"><tt class="method">is_https</tt></a></b>(</nobr></td>
250
 
  <td>)</td></tr></table>
 
324
  <td><nobr><b><tt id='l2h-63' xml:id='l2h-63' class="method">is_https</tt></b>(</nobr></td>
 
325
  <td><var></var>)</td></tr></table></dt>
251
326
<dd>
252
327
  Returns non-zero if the connection is using SSL/TLS. Will always return
253
328
  zero if the mod_ssl Apache module is not loaded.
268
343
 
269
344
<P>
270
345
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
271
 
  <td><nobr><b><a name="l2h-55"><tt class="method">log_error</tt></a></b>(</nobr></td>
272
 
  <td><var>message</var><big>[</big><var>, level</var><big>]</big>)</td></tr></table>
 
346
  <td><nobr><b><tt id='l2h-64' xml:id='l2h-64' class="method">log_error</tt></b>(</nobr></td>
 
347
  <td><var>message</var><big>[</big><var>, level</var><big>]</big><var></var>)</td></tr></table></dt>
273
348
<dd>
274
349
  An interface to the Apache <code>ap_log_rerror</code>
275
350
  function. <var>message</var> is a string with the error message,
295
370
 
296
371
<P>
297
372
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
298
 
  <td><nobr><b><a name="l2h-56"><tt class="method">meets_conditions</tt></a></b>(</nobr></td>
299
 
  <td>)</td></tr></table>
 
373
  <td><nobr><b><tt id='l2h-65' xml:id='l2h-65' class="method">meets_conditions</tt></b>(</nobr></td>
 
374
  <td><var></var>)</td></tr></table></dt>
300
375
<dd>
301
 
  Calls the Apache <tt class="cfunction">ap_meets_conditions()</tt> function which
302
 
  returns a status code.  If <var>status</var> is <tt class="constant">apache.OK</tt>, generate
303
 
  the content of the response normally.  If not, simply return <var>status</var>.
304
 
  Note that <tt class="member">req.headers_out</tt> should be set prior to calling this
305
 
  function.  The same goes for <tt class="member">req.status</tt> if the status differs
306
 
  from <tt class="constant">apache.OK</tt>.
 
376
  Calls the Apache <tt class="cfunction">ap_meets_conditions()</tt> function which returns
 
377
  a status code. If <var>status</var> is <tt class="constant">apache.OK</tt>, generate the
 
378
  content of the response normally. If not, simply return <var>status</var>.
 
379
  Note that <var>mtime</var> (and possibly the ETag header) should be set as
 
380
  appropriate prior to calling this function. The same goes for
 
381
  <tt class="member">req.status</tt> if the status differs from <tt class="constant">apache.OK</tt>.
307
382
 
308
383
<P>
309
384
Example:
310
385
  <div class="verbatim"><pre>
311
386
...
312
 
r.headers_out['ETag'] = "1130794f-3774-4584-a4ea-0ab19e684268"
313
 
r.headers_out['Last-Modified'] = 'Wed, 23 Feb 2005 00:00:00 GMT'
 
387
r.headers_out['ETag'] = '"1130794f-3774-4584-a4ea-0ab19e684268"'
314
388
r.headers_out['Expires'] = 'Mon, 18 Apr 2005 17:30:00 GMT'
 
389
r.update_mtime(1000000000)
 
390
r.set_last_modified()
315
391
 
316
392
status = r.meets_conditions()
317
393
if status != apache.OK:
325
401
 
326
402
<P>
327
403
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
328
 
  <td><nobr><b><a name="l2h-57"><tt class="method">requires</tt></a></b>(</nobr></td>
329
 
  <td>)</td></tr></table>
 
404
  <td><nobr><b><tt id='l2h-66' xml:id='l2h-66' class="method">requires</tt></b>(</nobr></td>
 
405
  <td><var></var>)</td></tr></table></dt>
330
406
<dd>
331
407
 
332
408
<P>
346
422
 
347
423
<P>
348
424
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
349
 
  <td><nobr><b><a name="l2h-58"><tt class="method">read</tt></a></b>(</nobr></td>
350
 
  <td><big>[</big><var>len</var><big>]</big>)</td></tr></table>
 
425
  <td><nobr><b><tt id='l2h-67' xml:id='l2h-67' class="method">read</tt></b>(</nobr></td>
 
426
  <td><var></var><big>[</big><var>len</var><big>]</big><var></var>)</td></tr></table></dt>
351
427
<dd>
352
428
 
353
429
<P>
375
451
 
376
452
<P>
377
453
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
378
 
  <td><nobr><b><a name="l2h-59"><tt class="method">readline</tt></a></b>(</nobr></td>
379
 
  <td><big>[</big><var>len</var><big>]</big>)</td></tr></table>
 
454
  <td><nobr><b><tt id='l2h-68' xml:id='l2h-68' class="method">readline</tt></b>(</nobr></td>
 
455
  <td><var></var><big>[</big><var>len</var><big>]</big><var></var>)</td></tr></table></dt>
380
456
<dd>
381
457
  Like <tt class="function">read()</tt> but reads until end of line. 
382
458
 
392
468
 
393
469
<P>
394
470
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
395
 
  <td><nobr><b><a name="l2h-60"><tt class="method">readlines</tt></a></b>(</nobr></td>
396
 
  <td><big>[</big><var>sizehint</var><big>]</big>)</td></tr></table>
 
471
  <td><nobr><b><tt id='l2h-69' xml:id='l2h-69' class="method">readlines</tt></b>(</nobr></td>
 
472
  <td><var></var><big>[</big><var>sizehint</var><big>]</big><var></var>)</td></tr></table></dt>
397
473
<dd>
398
 
  Reads all or up to <var>sizehint</var> bytes of lines using
399
 
  <tt class="method">readline</tt> and returns a list of the lines read.
 
474
  Reads all lines using <tt class="method">readline</tt> and returns a list of the lines read.
 
475
  If the optional <var>sizehint</var> parameter is given in, the method will read
 
476
  at least <var>sizehint</var> bytes of data, up to the completion of the line in
 
477
  which the <var>sizehint</var> bytes limit is reached.
400
478
</dl>
401
479
 
402
480
<P>
403
481
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
404
 
  <td><nobr><b><a name="l2h-61"><tt class="method">register_cleanup</tt></a></b>(</nobr></td>
405
 
  <td><var>callable</var><big>[</big><var>, data</var><big>]</big>)</td></tr></table>
 
482
  <td><nobr><b><tt id='l2h-70' xml:id='l2h-70' class="method">register_cleanup</tt></b>(</nobr></td>
 
483
  <td><var>callable</var><big>[</big><var>, data</var><big>]</big><var></var>)</td></tr></table></dt>
406
484
<dd>
407
485
 
408
486
<P>
432
510
 
433
511
<P>
434
512
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
435
 
  <td><nobr><b><a name="l2h-62"><tt class="method">sendfile</tt></a></b>(</nobr></td>
436
 
  <td><var>path</var><big>[</big><var>, offset, len</var><big>]</big>)</td></tr></table>
 
513
  <td><nobr><b><tt id='l2h-71' xml:id='l2h-71' class="method">register_input_filter</tt></b>(</nobr></td>
 
514
  <td><var>filter_name, filter</var><big>[</big><var>, dir</var><big>]</big><var></var>)</td></tr></table></dt>
 
515
<dd>
 
516
 
 
517
<P>
 
518
Allows dynamic registration of mod_python input filters. <var>filter_name</var>
 
519
  is a string which would then subsequently be used to identify the filter.
 
520
  <var>filter</var> is a string containing the name of the module and the filter
 
521
  function or the callable object itself.  Optional <var>dir</var> is a string
 
522
  containing the name of the directory to be added to the module search when
 
523
  looking for the module.
 
524
 
 
525
<P>
 
526
The registration of the filter this way only persists for the life of the
 
527
  request. To actually add the filter into the chain of input filters for
 
528
  the current request <code>req.add_input_filter()</code> would be used.
 
529
 
 
530
<P>
 
531
</dl>
 
532
 
 
533
<P>
 
534
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
 
535
  <td><nobr><b><tt id='l2h-72' xml:id='l2h-72' class="method">register_output_filter</tt></b>(</nobr></td>
 
536
  <td><var>filter_name, filter</var><big>[</big><var>, dir</var><big>]</big><var></var>)</td></tr></table></dt>
 
537
<dd>
 
538
 
 
539
<P>
 
540
Allows dynamic registration of mod_python output filters. <var>filter_name</var>
 
541
  is a string which would then subsequently be used to identify the filter.
 
542
  <var>filter</var> is a string containing the name of the module and the filter
 
543
  function or the callable object itself. Optional <var>dir</var> is a string
 
544
  containing the name of the directory to be added to the module search
 
545
  path when looking for the handler.
 
546
 
 
547
<P>
 
548
The registration of the filter this way only persists for the life of the
 
549
  request. To actually add the filter into the chain of output filters for
 
550
  the current request <code>req.add_output_filter()</code> would be used.
 
551
 
 
552
<P>
 
553
</dl>
 
554
 
 
555
<P>
 
556
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
 
557
  <td><nobr><b><tt id='l2h-73' xml:id='l2h-73' class="method">sendfile</tt></b>(</nobr></td>
 
558
  <td><var>path</var><big>[</big><var>, offset, len</var><big>]</big><var></var>)</td></tr></table></dt>
437
559
<dd>
438
560
  Sends <var>len</var> bytes of file <var>path</var> directly to the client,
439
561
  starting at offset <var>offset</var> using the server's internal
451
573
 
452
574
<P>
453
575
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
454
 
  <td><nobr><b><a name="l2h-63"><tt class="method">ssl_var_lookup</tt></a></b>(</nobr></td>
455
 
  <td><var>var_name</var>)</td></tr></table>
 
576
  <td><nobr><b><tt id='l2h-74' xml:id='l2h-74' class="method">set_etag</tt></b>(</nobr></td>
 
577
  <td><var></var>)</td></tr></table></dt>
 
578
<dd>
 
579
  Sets the outgoing "<tt class="samp">ETag</tt>" header.
 
580
</dl>
 
581
 
 
582
<P>
 
583
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
 
584
  <td><nobr><b><tt id='l2h-75' xml:id='l2h-75' class="method">set_last_modified</tt></b>(</nobr></td>
 
585
  <td><var></var>)</td></tr></table></dt>
 
586
<dd>
 
587
  Sets the outgoing "<tt class="samp">Last-Modified</tt>" header based on value of
 
588
  <code>mtime</code> attribute.
 
589
</dl>
 
590
 
 
591
<P>
 
592
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
 
593
  <td><nobr><b><tt id='l2h-76' xml:id='l2h-76' class="method">ssl_var_lookup</tt></b>(</nobr></td>
 
594
  <td><var>var_name</var>)</td></tr></table></dt>
456
595
<dd>
457
596
  Looks up the value of the named SSL variable.  This method queries
458
597
  the mod_ssl Apache module directly, and may therefore be used in
495
634
 
496
635
<P>
497
636
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
498
 
  <td><nobr><b><a name="l2h-64"><tt class="method">write</tt></a></b>(</nobr></td>
499
 
  <td><var>string</var><big>[</big><var>, flush=1</var><big>]</big>)</td></tr></table>
 
637
  <td><nobr><b><tt id='l2h-77' xml:id='l2h-77' class="method">update_mtime</tt></b>(</nobr></td>
 
638
  <td><var>dependency_mtime</var>)</td></tr></table></dt>
 
639
<dd>
 
640
  If <var>dependency_mtime</var> is later than the value in the <code>mtime</code>
 
641
  attribute, sets the attribute to the new value.
 
642
</dl>
 
643
 
 
644
<P>
 
645
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
 
646
  <td><nobr><b><tt id='l2h-78' xml:id='l2h-78' class="method">write</tt></b>(</nobr></td>
 
647
  <td><var>string</var><big>[</big><var>, flush=1</var><big>]</big><var></var>)</td></tr></table></dt>
500
648
<dd>
501
649
  Writes <var>string</var> directly to the client, then flushes the buffer,
502
650
  unless flush is 0.
504
652
 
505
653
<P>
506
654
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
507
 
  <td><nobr><b><a name="l2h-65"><tt class="method">flush</tt></a></b>(</nobr></td>
508
 
  <td>)</td></tr></table>
 
655
  <td><nobr><b><tt id='l2h-79' xml:id='l2h-79' class="method">flush</tt></b>(</nobr></td>
 
656
  <td><var></var>)</td></tr></table></dt>
509
657
<dd>
510
658
  Flushes the output buffer.
511
659
</dl>
512
660
 
513
661
<P>
514
662
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
515
 
  <td><nobr><b><a name="l2h-66"><tt class="method">set_content_length</tt></a></b>(</nobr></td>
516
 
  <td><var>len</var>)</td></tr></table>
 
663
  <td><nobr><b><tt id='l2h-80' xml:id='l2h-80' class="method">set_content_length</tt></b>(</nobr></td>
 
664
  <td><var>len</var>)</td></tr></table></dt>
517
665
<dd>
518
666
  Sets the value of <tt class="member">req.clength</tt> and the "<tt class="samp">Content-Length</tt>"  header to len. Note that after the headers have been sent out (which
519
667
  happens just before the first byte of the body is written,
524
672
<P>
525
673
 
526
674
<DIV CLASS="navigation">
527
 
<p><hr>
 
675
<div class='online-navigation'>
 
676
<p></p><hr />
528
677
<table align="center" width="100%" cellpadding="0" cellspacing="2">
529
678
<tr>
530
 
<td><a rel="prev" title="4.5.3 Request Object&nbsp;" 
531
 
  rel="prev" title="4.5.3 Request Object&nbsp;" 
532
 
  href="pyapi-mprequest.html"><img src='previous.gif'
533
 
  border='0' height='32'  alt='Previous Page' width='32'></A></td>
534
 
<td><a rel="parent" title="4.5.3 Request Object&nbsp;" 
535
 
  rel="parent" title="4.5.3 Request Object&nbsp;" 
536
 
  href="pyapi-mprequest.html"><img src='up.gif'
537
 
  border='0' height='32'  alt='Up One Level' width='32'></A></td>
538
 
<td><a rel="next" title="4.5.3.2 Request Members" 
539
 
  rel="next" title="4.5.3.2 Request Members" 
540
 
  href="pyapi-mprequest-mem.html"><img src='next.gif'
541
 
  border='0' height='32'  alt='Next Page' width='32'></A></td>
 
679
<td class='online-navigation'><a rel="prev" title="4.5.4 Request Object"
 
680
  href="pyapi-mprequest.html"><img src='previous.png'
 
681
  border='0' height='32'  alt='Previous Page' width='32' /></A></td>
 
682
<td class='online-navigation'><a rel="parent" title="4.5.4 Request Object"
 
683
  href="pyapi-mprequest.html"><img src='up.png'
 
684
  border='0' height='32'  alt='Up One Level' width='32' /></A></td>
 
685
<td class='online-navigation'><a rel="next" title="4.5.4.2 Request Members"
 
686
  href="pyapi-mprequest-mem.html"><img src='next.png'
 
687
  border='0' height='32'  alt='Next Page' width='32' /></A></td>
542
688
<td align="center" width="100%">Mod_python Manual</td>
543
 
<td><a rel="contents" title="Table of Contents" 
544
 
  rel="contents" title="Table of Contents" 
545
 
  href="contents.html"><img src='contents.gif'
546
 
  border='0' height='32'  alt='Contents' width='32'></A></td>
547
 
<td><img src='blank.gif'
548
 
  border='0' height='32'  alt='' width='32'></td>
549
 
<td><a rel="index" title="Index" 
550
 
  rel="index" title="Index" 
551
 
  href="genindex.html"><img src='index.gif'
552
 
  border='0' height='32'  alt='Index' width='32'></A></td>
 
689
<td class='online-navigation'><a rel="contents" title="Table of Contents"
 
690
  href="contents.html"><img src='contents.png'
 
691
  border='0' height='32'  alt='Contents' width='32' /></A></td>
 
692
<td class='online-navigation'><img src='blank.png'
 
693
  border='0' height='32'  alt='' width='32' /></td>
 
694
<td class='online-navigation'><a rel="index" title="Index"
 
695
  href="genindex.html"><img src='index.png'
 
696
  border='0' height='32'  alt='Index' width='32' /></A></td>
553
697
</tr></table>
 
698
<div class='online-navigation'>
554
699
<b class="navlabel">Previous:</b>
555
 
<a class="sectref" rel="prev" href="pyapi-mprequest.html">4.5.3 Request Object&nbsp;</A>
 
700
<a class="sectref" rel="prev" href="pyapi-mprequest.html">4.5.4 Request Object</A>
556
701
<b class="navlabel">Up:</b>
557
 
<a class="sectref" rel="parent" href="pyapi-mprequest.html">4.5.3 Request Object&nbsp;</A>
 
702
<a class="sectref" rel="parent" href="pyapi-mprequest.html">4.5.4 Request Object</A>
558
703
<b class="navlabel">Next:</b>
559
 
<a class="sectref" rel="next" href="pyapi-mprequest-mem.html">4.5.3.2 Request Members</A>
560
 
<hr>
561
 
<span class="release-info">Release 3.2.10, documentation updated on July 19, 2006.</span>
 
704
<a class="sectref" rel="next" href="pyapi-mprequest-mem.html">4.5.4.2 Request Members</A>
 
705
</div>
 
706
</div>
 
707
<hr />
 
708
<span class="release-info">Release 3.3.1, documentation updated on January 29, 2007.</span>
562
709
</DIV>
563
710
<!--End of Navigation Panel-->
564
711