[mod_python] psp module

Graham Dumpleton grahamd at dscpl.com.au
Wed May 25 08:22:48 EDT 2005

On 25/05/2005, at 9:27 PM, eoghan wrote:

> Hi
> Im new to python. Im playing with the psp module. I have noticed that 
> whitespace is maintained in the output,. Is there anyway to strip this 
> from the generated content? Also, how can i tab my output? Using the 
> example:
> <html>
> <%
> import time
> %>
> Hello world, the time is: <%=time.strftime("%Y-%m-%d, %H:%M:%S")%>
> </html>
> this produces:
> <html>
> Hello world, the time is: 2005-05-25, 12:26:25
> </html>
> What id like is:
> <html>
>     Hello world, the time is: 2005-05-25, 12:26:25
> </html>

Based on examples on web site as to what code is generated from the PSP 
ie., at:


The code generated will always insert a new line at the start of each 
of HTML between PSP code blocks. Thus you will always get the blank 

You might look at the display_code() method of the PSP class as 
on that page and experiment with it to display side by side what the PSP
source and generated code look like.

As to tabbing, I believe that if you simply indent it in your PSP 
source file,
it should preserve whatever tabbing you used. At least that is how it 
behaved for me before.


More information about the Mod_python mailing list