[mod_python] syntax errors

Graham Dumpleton grahamd at dscpl.com.au
Tue May 9 22:32:59 EDT 2006


David Bear wrote ..
> I'm using psp handler like this:
> 
> <Directory "/www/htdocs/psp">
>  AddHandler mod_python .psp
>  PythonHandler mod_python.psp
>  PythonDebug On
> </Directory>
> 
> my html.psp file contains a simple exercise from onlamp demonstrating
> psp and looks like this:
> 
> 
> <html>
>  <head>
>    <title>A psp test </title>
>  </head>
>  <body>
> <% 
> if form.has_key('name'):
>    greet = 'Hellow %s ' % form.['name'].capitalize()
> else: 
>    greet = 'hellow nobody '
> %>
>    <h1>A greeting test </h1>
>    <%= greet %>
>  </body>
> <html>
> 
> I am getting a syntax error. My reading of the onlamp article
> indicated that indentation shouldn't be a problem -- and indentation
> is consistent. I'm just not seeing the error.
> 
> There must be something really simple that I'm missing. Any
> suggestions?

Replace your four space indent with tabs. PSP is fussy.

Alternatively, read the following:

 http://www.modpython.org/pipermail/mod_python/2005-May/018102.html

as to how to include indent hints so you can use four spaces instead.

Graham


More information about the Mod_python mailing list