mod_python.servlet.Servlet and place it in a
file with the same basename as the class name and with a
.mps extenstion.
write_content
method.
writeln method which sends
output to the client browser.
index in a file named index.mps (the
handler automatically looks for a file named index.mps if a
directory is specified). It subclasses TutorialBase
(which, trust for now, is ultimately a subclass of
mod_python.servlet.Servlet). There is only one
method, write_content which makes a single call
to writeln with this text.
This servlet also sets a single instance variable,
title, which sets the title of this page.
After viewing the python source (click on the link above) you may
be wondering how the big, centered title got on this page, as well
as the horizontal rules and the navigation links, etc. They come
from the TutorialBase superclass, but do not worry
about that for now; that will be explained later in this tutorial.
For now, just know that all the output made by
write_content with calls to writeln will
go between the horizontal rules.
If you view the HTML that is generated by the servlet you will
notice that all the content sent to the browser by
write_content is placed inside
<BODY>...</BODY> tags. How the rest of the HTML is
generated and how you can control it will be shown throughout this
tutorial.
In the next example, you will see what happens when you do not
override write_content.