1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
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-classes.html">
11
<LINK REL="parent" href="pyapi-sess.html">
12
<LINK REL="next" href="pyapi-psp.html">
13
<meta name='aesop' content='information'>
14
<META NAME="description" CONTENT="Examples">
15
<META NAME="keywords" CONTENT="modpython">
16
<META NAME="resource-type" CONTENT="document">
17
<META NAME="distribution" CONTENT="global">
18
<title>4.8.2 Examples</title>
21
<DIV CLASS="navigation">
22
<table align="center" width="100%" cellpadding="0" cellspacing="2">
24
<td><a rel="prev" title="4.8.1 Classes"
25
href="pyapi-sess-classes.html"><img src='previous.gif'
26
border='0' height='32' alt='Previous Page' width='32'></A></td>
27
<td><a rel="parent" title="4.8 Session - Session"
28
href="pyapi-sess.html"><img src='up.gif'
29
border='0' height='32' alt='Up One Level' width='32'></A></td>
30
<td><a rel="next" title="4.9 psp - Python"
31
href="pyapi-psp.html"><img src='next.gif'
32
border='0' height='32' alt='Next Page' width='32'></A></td>
33
<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>
43
<b class="navlabel">Previous:</b>
44
<a class="sectref" rel="prev" href="pyapi-sess-classes.html">4.8.1 Classes</A>
45
<b class="navlabel">Up:</b>
46
<a class="sectref" rel="parent" href="pyapi-sess.html">4.8 Session - Session</A>
47
<b class="navlabel">Next:</b>
48
<a class="sectref" rel="next" href="pyapi-psp.html">4.9 psp - Python</A>
51
<!--End of Navigation Panel-->
53
<H2><A NAME="SECTION006820000000000000000"> </A>
57
The following example demonstrates a simple hit counter.
60
<div class="verbatim"><pre>
61
from mod_python import Session
64
session = Session.Session(req)
73
req.content_type = 'text/plain'
74
req.write('Hits: %d\n' % session['hits'])
80
<DIV CLASS="navigation">
82
<table align="center" width="100%" cellpadding="0" cellspacing="2">
84
<td><a rel="prev" title="4.8.1 Classes"
85
rel="prev" title="4.8.1 Classes"
86
href="pyapi-sess-classes.html"><img src='previous.gif'
87
border='0' height='32' alt='Previous Page' width='32'></A></td>
88
<td><a rel="parent" title="4.8 Session - Session"
89
rel="parent" title="4.8 Session - Session"
90
href="pyapi-sess.html"><img src='up.gif'
91
border='0' height='32' alt='Up One Level' width='32'></A></td>
92
<td><a rel="next" title="4.9 psp - Python"
93
rel="next" title="4.9 psp - Python"
94
href="pyapi-psp.html"><img src='next.gif'
95
border='0' height='32' alt='Next Page' width='32'></A></td>
96
<td align="center" width="100%">Mod_python Manual</td>
97
<td><a rel="contents" title="Table of Contents"
98
rel="contents" title="Table of Contents"
99
href="contents.html"><img src='contents.gif'
100
border='0' height='32' alt='Contents' width='32'></A></td>
101
<td><img src='blank.gif'
102
border='0' height='32' alt='' width='32'></td>
103
<td><a rel="index" title="Index"
104
rel="index" title="Index"
105
href="genindex.html"><img src='index.gif'
106
border='0' height='32' alt='Index' width='32'></A></td>
108
<b class="navlabel">Previous:</b>
109
<a class="sectref" rel="prev" href="pyapi-sess-classes.html">4.8.1 Classes</A>
110
<b class="navlabel">Up:</b>
111
<a class="sectref" rel="parent" href="pyapi-sess.html">4.8 Session - Session</A>
112
<b class="navlabel">Next:</b>
113
<a class="sectref" rel="next" href="pyapi-psp.html">4.9 psp - Python</A>
115
<span class="release-info">Release 3.2.8, documentation updated on February 19, 2006.</span>
117
<!--End of Navigation Panel-->