[mod_python] Templaing question

Jorey Bump list at joreybump.com
Tue Mar 7 08:53:00 EST 2006

Michael Guerrero wrote:

> def index(req):
>     req.content_type = 'text/html'
>     req.write(docType()) # a function which puts the doctype in the page.
>     req.write(head(title('Word List') + link('StyleSheet', 
> 'index.css'))) # more functions to put the right tags in.

Note that you are generating XHTML for an HTML DOCTYPE.

> The page it creates looks like:
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 

You've told the browser you are using HTML.

> "http://www.w3.org/TR/html4/loose.dtd">
> <html>
> <head>
> <title>Word List</title>
> <link rel="StyleSheet" href="index.css" />

In XHTML, this is a self-closing tag. But in HTML, this embeds a literal 
">" character. You need to generate code consistent with your DOCTYPE.

More information about the Mod_python mailing list