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 source, ie., at: http://www.modpython.org/live/current/doc-html/pyapi-psp.html The code generated will always insert a new line at the start of each section of HTML between PSP code blocks. Thus you will always get the blank lines. You might look at the display_code() method of the PSP class as documented 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 has behaved for me before. Graham
|