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

« back to all changes in this revision

Viewing changes to doc-html/pyapi-psp.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="prev" href="pyapi-sess.html">
11
 
<LINK REL="parent" href="pythonapi.html">
12
 
<LINK REL="next" href="directives.html">
13
 
<meta name='aesop' content='information'>
14
 
<META NAME="description" CONTENT="psp - Python Server Pages">
15
 
<META NAME="keywords" CONTENT="modpython">
16
 
<META NAME="resource-type" CONTENT="document">
17
 
<META NAME="distribution" CONTENT="global">
 
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="prev" href="pyapi-sess.html" />
 
11
<link rel="parent" href="pythonapi.html" />
 
12
<link rel="next" href="directives.html" />
 
13
<meta name='aesop' content='information' />
18
14
<title>4.9 psp - Python Server Pages</title>
19
15
</head>
20
16
<body>
21
17
<DIV CLASS="navigation">
 
18
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
22
19
<table align="center" width="100%" cellpadding="0" cellspacing="2">
23
20
<tr>
24
 
<td><a rel="prev" title="4.8.2 Examples" 
25
 
  href="pyapi-sess-example.html"><img src='previous.gif'
26
 
  border='0' height='32'  alt='Previous Page' width='32'></A></td>
27
 
<td><a rel="parent" title="4. Python API" 
28
 
  href="pythonapi.html"><img src='up.gif'
29
 
  border='0' height='32'  alt='Up One Level' width='32'></A></td>
30
 
<td><a rel="next" title="5. Apache Configuration Directives" 
31
 
  href="directives.html"><img src='next.gif'
32
 
  border='0' height='32'  alt='Next Page' width='32'></A></td>
 
21
<td class='online-navigation'><a rel="prev" title="4.8.2 Examples"
 
22
  href="pyapi-sess-example.html"><img src='previous.png'
 
23
  border='0' height='32'  alt='Previous Page' width='32' /></A></td>
 
24
<td class='online-navigation'><a rel="parent" title="4. Python API"
 
25
  href="pythonapi.html"><img src='up.png'
 
26
  border='0' height='32'  alt='Up One Level' width='32' /></A></td>
 
27
<td class='online-navigation'><a rel="next" title="5. Apache Configuration Directives"
 
28
  href="directives.html"><img src='next.png'
 
29
  border='0' height='32'  alt='Next Page' width='32' /></A></td>
33
30
<td align="center" width="100%">Mod_python Manual</td>
34
 
<td><a rel="contents" title="Table of Contents" 
35
 
  href="contents.html"><img src='contents.gif'
36
 
  border='0' height='32'  alt='Contents' width='32'></A></td>
37
 
<td><img src='blank.gif'
38
 
  border='0' height='32'  alt='' width='32'></td>
39
 
<td><a rel="index" title="Index" 
40
 
  href="genindex.html"><img src='index.gif'
41
 
  border='0' height='32'  alt='Index' width='32'></A></td>
 
31
<td class='online-navigation'><a rel="contents" title="Table of Contents"
 
32
  href="contents.html"><img src='contents.png'
 
33
  border='0' height='32'  alt='Contents' width='32' /></A></td>
 
34
<td class='online-navigation'><img src='blank.png'
 
35
  border='0' height='32'  alt='' width='32' /></td>
 
36
<td class='online-navigation'><a rel="index" title="Index"
 
37
  href="genindex.html"><img src='index.png'
 
38
  border='0' height='32'  alt='Index' width='32' /></A></td>
42
39
</tr></table>
 
40
<div class='online-navigation'>
43
41
<b class="navlabel">Previous:</b>
44
42
<a class="sectref" rel="prev" href="pyapi-sess-example.html">4.8.2 Examples</A>
45
43
<b class="navlabel">Up:</b>
46
44
<a class="sectref" rel="parent" href="pythonapi.html">4. Python API</A>
47
45
<b class="navlabel">Next:</b>
48
46
<a class="sectref" rel="next" href="directives.html">5. Apache Configuration Directives</A>
49
 
<br><hr>
 
47
</div>
 
48
<hr /></div>
50
49
</DIV>
51
50
<!--End of Navigation Panel-->
52
51
 
53
 
<H1><A NAME="SECTION006900000000000000000">&nbsp;</A>
 
52
<H1><A NAME="SECTION006900000000000000000"></A><A NAME="pyapi-psp"></A>
54
53
<BR>
55
54
4.9 <tt class="module">psp</tt> - Python Server Pages
56
55
</H1>
57
 
 
 
56
<A NAME="module-psp"></A>
58
57
 
59
58
<P>
60
59
The <tt class="module">psp</tt> module provides a way to convert text documents
69
68
and is therefore very fast.
70
69
 
71
70
<P>
72
 
<i>See <A href="hand-psp.html#hand-psp">6.2</A> ``PSP Handler'' for additional PSP
73
 
information.</i>
 
71
<em>See <A href="hand-psp.html#hand-psp">7.2</A> ``PSP Handler'' for additional PSP
 
72
information.</em>
74
73
 
75
74
<P>
76
75
Inside the document, Python <i class="dfn">code</i> needs to be surrounded by
195
194
 
196
195
<P>
197
196
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
198
 
  <td><nobr><b><span class="typelabel">class</span>&nbsp;<a name="l2h-235"><tt class="class">PSP</tt></a></b>(</nobr></td>
199
 
  <td><var>req, </var><big>[</big><var>, filename, string, vars</var><big>]</big>)</td></tr></table>
 
197
  <td><nobr><b><span class="typelabel">class</span>&nbsp;<tt id='l2h-258' xml:id='l2h-258' class="class">PSP</tt></b>(</nobr></td>
 
198
  <td><var>req, </var><big>[</big><var>, filename, string, vars</var><big>]</big><var></var>)</td></tr></table></dt>
200
199
<dd>
201
200
  This class represents a PSP object.
202
201
 
230
229
  bsd db. You will need to check which implementation <tt class="module">anydbm</tt>
231
230
  defaults to on your system as some dbm libraries impose a limit on
232
231
  the size of the entry making them unsuitable. Dbm caching can be
233
 
  enabled via <code>PSPDbmCache</code> Python option, e.g.:
 
232
  enabled via <code>mod_python.psp.cache_database_filename</code> Python
 
233
  option, e.g.:
234
234
 
235
235
<P>
236
236
<div class="verbatim"><pre>
237
 
PythonOption PSPDbmCache ``/tmp/pspcache.dbm''
 
237
PythonOption mod_python.psp.cache_database_filename ``/tmp/pspcache.dbm''
238
238
</pre></div>
239
239
  Note that the dbm cache file is not deleted when the server
240
240
  restarts.
245
245
  this time.
246
246
 
247
247
<P>
 
248
Note that the above name for the option setting was only changed to
 
249
  this value in mod_python 3.3. If you need to retain backward compatability
 
250
  with older versions of mod_python use the <code>PSPDbmCache</code> option
 
251
  instead.
 
252
 
 
253
<P>
248
254
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
249
 
  <td><nobr><b><a name="l2h-236"><tt class="method">run</tt></a></b>(</nobr></td>
250
 
  <td><big>[</big><var>vars</var><big>]</big>)</td></tr></table>
 
255
  <td><nobr><b><tt id='l2h-259' xml:id='l2h-259' class="method">run</tt></b>(</nobr></td>
 
256
  <td><var></var><big>[</big><var>vars, flush</var><big>]</big><var></var>)</td></tr></table></dt>
251
257
<dd>
252
258
    This method will execute the code (produced at object
253
259
    initialization time by parsing and compiling the PSP
254
260
    source). Optional argument <var>vars</var> is a dictionary keyed by
255
 
    strings that will be passed in as global variables.
 
261
    strings that will be passed in as global variables. Optional
 
262
    argument <var>flush</var> is a boolean flag indicating whether output
 
263
    should be flushed. The default is not to flush output.
256
264
 
257
265
<P>
258
266
Additionally, the PSP code will be given global variables
268
276
 
269
277
<P>
270
278
The object passed in <code>psp</code> is an instance of
271
 
    <tt class="class">PSPInstance</tt>.
 
279
    <tt class="class">PSPInterface</tt>.
272
280
 
273
281
<P>
274
282
</dl>
275
283
 
276
284
<P>
277
285
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
278
 
  <td><nobr><b><a name="l2h-237"><tt class="method">display_code</tt></a></b>(</nobr></td>
279
 
  <td>)</td></tr></table>
 
286
  <td><nobr><b><tt id='l2h-260' xml:id='l2h-260' class="method">display_code</tt></b>(</nobr></td>
 
287
  <td><var></var>)</td></tr></table></dt>
280
288
<dd>
281
289
    Returns an HTML-formatted string representing a side-by-side
282
290
    listing of the original PSP code and resulting Python code
310
318
 
311
319
<P>
312
320
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
313
 
  <td><nobr><b><span class="typelabel">class</span>&nbsp;<a name="l2h-238"><tt class="class">PSPInstance</tt></a></b>(</nobr></td>
314
 
  <td>)</td></tr></table>
 
321
  <td><nobr><b><span class="typelabel">class</span>&nbsp;<tt id='l2h-261' xml:id='l2h-261' class="class">PSPInterface</tt></b>(</nobr></td>
 
322
  <td><var></var>)</td></tr></table></dt>
315
323
<dd>
316
324
  An object of this class is passed as a global variable <code>psp</code> to
317
325
  the PSP code. Objects of this class are instantiated internally and
319
327
 
320
328
<P>
321
329
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
322
 
  <td><nobr><b><a name="l2h-239"><tt class="method">set_error_page</tt></a></b>(</nobr></td>
323
 
  <td><var>filename</var>)</td></tr></table>
 
330
  <td><nobr><b><tt id='l2h-262' xml:id='l2h-262' class="method">set_error_page</tt></b>(</nobr></td>
 
331
  <td><var>filename</var>)</td></tr></table></dt>
324
332
<dd>
325
333
    Used to set a psp page to be processed when an exception
326
334
    occurs. If the path is absolute, it will be appended to document
332
340
 
333
341
<P>
334
342
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
335
 
  <td><nobr><b><a name="l2h-240"><tt class="method">apply_data</tt></a></b>(</nobr></td>
336
 
  <td><var>object</var><big>[</big><var>, **kw</var><big>]</big>)</td></tr></table>
 
343
  <td><nobr><b><tt id='l2h-263' xml:id='l2h-263' class="method">apply_data</tt></b>(</nobr></td>
 
344
  <td><var>object</var><big>[</big><var>, **kw</var><big>]</big><var></var>)</td></tr></table></dt>
337
345
<dd>
338
346
    This method will call the callable object <var>object</var>, passing form
339
347
    data as keyword arguments, and return the result.
341
349
 
342
350
<P>
343
351
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
344
 
  <td><nobr><b><a name="l2h-241"><tt class="method">redirect</tt></a></b>(</nobr></td>
345
 
  <td><var>location</var><big>[</big><var>, permanent=0</var><big>]</big>)</td></tr></table>
 
352
  <td><nobr><b><tt id='l2h-264' xml:id='l2h-264' class="method">redirect</tt></b>(</nobr></td>
 
353
  <td><var>location</var><big>[</big><var>, permanent=0</var><big>]</big><var></var>)</td></tr></table></dt>
346
354
<dd>
347
355
    This method will redirect the browser to location
348
356
    <var>location</var>. If <var>permanent</var> is true, then
377
385
 
378
386
<P>
379
387
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
380
 
  <td><nobr><b><a name="l2h-242"><tt class="function">parse</tt></a></b>(</nobr></td>
381
 
  <td><var>filename</var><big>[</big><var>, dir</var><big>]</big>)</td></tr></table>
 
388
  <td><nobr><b><tt id='l2h-265' xml:id='l2h-265' class="function">parse</tt></b>(</nobr></td>
 
389
  <td><var>filename</var><big>[</big><var>, dir</var><big>]</big><var></var>)</td></tr></table></dt>
382
390
<dd>
383
391
 
384
392
<P>
395
403
 
396
404
<P>
397
405
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
398
 
  <td><nobr><b><a name="l2h-243"><tt class="function">parsestring</tt></a></b>(</nobr></td>
399
 
  <td><var>string</var>)</td></tr></table>
 
406
  <td><nobr><b><tt id='l2h-266' xml:id='l2h-266' class="function">parsestring</tt></b>(</nobr></td>
 
407
  <td><var>string</var>)</td></tr></table></dt>
400
408
<dd>
401
409
 
402
410
<P>
407
415
</dl>
408
416
 
409
417
<DIV CLASS="navigation">
410
 
<p><hr>
 
418
<div class='online-navigation'>
 
419
<p></p><hr />
411
420
<table align="center" width="100%" cellpadding="0" cellspacing="2">
412
421
<tr>
413
 
<td><a rel="prev" title="4.8.2 Examples" 
414
 
  rel="prev" title="4.8.2 Examples" 
415
 
  href="pyapi-sess-example.html"><img src='previous.gif'
416
 
  border='0' height='32'  alt='Previous Page' width='32'></A></td>
417
 
<td><a rel="parent" title="4. Python API" 
418
 
  rel="parent" title="4. Python API" 
419
 
  href="pythonapi.html"><img src='up.gif'
420
 
  border='0' height='32'  alt='Up One Level' width='32'></A></td>
421
 
<td><a rel="next" title="5. Apache Configuration Directives" 
422
 
  rel="next" title="5. Apache Configuration Directives" 
423
 
  href="directives.html"><img src='next.gif'
424
 
  border='0' height='32'  alt='Next Page' width='32'></A></td>
 
422
<td class='online-navigation'><a rel="prev" title="4.8.2 Examples"
 
423
  href="pyapi-sess-example.html"><img src='previous.png'
 
424
  border='0' height='32'  alt='Previous Page' width='32' /></A></td>
 
425
<td class='online-navigation'><a rel="parent" title="4. Python API"
 
426
  href="pythonapi.html"><img src='up.png'
 
427
  border='0' height='32'  alt='Up One Level' width='32' /></A></td>
 
428
<td class='online-navigation'><a rel="next" title="5. Apache Configuration Directives"
 
429
  href="directives.html"><img src='next.png'
 
430
  border='0' height='32'  alt='Next Page' width='32' /></A></td>
425
431
<td align="center" width="100%">Mod_python Manual</td>
426
 
<td><a rel="contents" title="Table of Contents" 
427
 
  rel="contents" title="Table of Contents" 
428
 
  href="contents.html"><img src='contents.gif'
429
 
  border='0' height='32'  alt='Contents' width='32'></A></td>
430
 
<td><img src='blank.gif'
431
 
  border='0' height='32'  alt='' width='32'></td>
432
 
<td><a rel="index" title="Index" 
433
 
  rel="index" title="Index" 
434
 
  href="genindex.html"><img src='index.gif'
435
 
  border='0' height='32'  alt='Index' width='32'></A></td>
 
432
<td class='online-navigation'><a rel="contents" title="Table of Contents"
 
433
  href="contents.html"><img src='contents.png'
 
434
  border='0' height='32'  alt='Contents' width='32' /></A></td>
 
435
<td class='online-navigation'><img src='blank.png'
 
436
  border='0' height='32'  alt='' width='32' /></td>
 
437
<td class='online-navigation'><a rel="index" title="Index"
 
438
  href="genindex.html"><img src='index.png'
 
439
  border='0' height='32'  alt='Index' width='32' /></A></td>
436
440
</tr></table>
 
441
<div class='online-navigation'>
437
442
<b class="navlabel">Previous:</b>
438
443
<a class="sectref" rel="prev" href="pyapi-sess-example.html">4.8.2 Examples</A>
439
444
<b class="navlabel">Up:</b>
440
445
<a class="sectref" rel="parent" href="pythonapi.html">4. Python API</A>
441
446
<b class="navlabel">Next:</b>
442
447
<a class="sectref" rel="next" href="directives.html">5. Apache Configuration Directives</A>
443
 
<hr>
444
 
<span class="release-info">Release 3.2.10, documentation updated on July 19, 2006.</span>
 
448
</div>
 
449
</div>
 
450
<hr />
 
451
<span class="release-info">Release 3.3.1, documentation updated on January 29, 2007.</span>
445
452
</DIV>
446
453
<!--End of Navigation Panel-->
447
454