[mod_python] [SPAM] Sample .psp code returns a blank page

Graham Dumpleton graham.dumpleton at gmail.com
Thu May 22 20:48:07 EDT 2008


2008/5/22 Rob Shinn <rob.shinn at gmail.com>:
> <html>
> <%
> import time
> %>
> Hello <%=what%> the time is: <%=time.strftime("%Y-%m-%d, %H:%M:%S")%>
> </html>

Which isn't strictly going to produce valid HTML as you are missing
<body> element.

Since I don't have the time to try your code and debug it and no one
else is piping up, I can suggest only two things.

First is that you upgrade to the latest version of mod_python and stop
using the older version. It isn't going to help one bit if you are
using older (potentially buggy version) and also referring to latest
documentation, which may differ.

Secondly, work through tutorials at:

  http://webpython.codepoint.net/mod_python

The examples there at least appear to use correct HTML.

Graham

> On Thu, May 22, 2008 at 8:26 AM, Graham Dumpleton
> <graham.dumpleton at gmail.com> wrote:
>>
>> Post the actual PSP code.
>>
>> 2008/5/22 Rob Shinn <rob.shinn at gmail.com>:
>> > Yep.  Tried "view source" and it's empty. The PSP code is copied and
>> > pasted
>> > from the first example in the docs.  What's weird is that the
>> > PublisherHandler works just fine for non-PSP code.
>> >
>> >
>> > On Wed, May 21, 2008 at 11:44 PM, Graham Dumpleton
>> > <graham.dumpleton at gmail.com> wrote:
>> >>
>> >> Are you sure it is blank? Are you sure you haven't made a mistake in
>> >> any HTML and the browser is treating the whole contents as part of the
>> >> markup and therefore not displaying?
>> >>
>> >> Try 'View Source' on the response in the browser.
>> >>
>> >> Graham
>> >>
>> >> 2008/5/22 Rob Shinn <rob.shinn at gmail.com>:
>> >> > tried running the sample "Hello, world" PSP script from the
>> >> > documentation
>> >> > but it just returns a blank page. I'm running mod_python 3.2.10 on
>> >> > Apache
>> >> > 2.2.3 running under Ubuntu 7.04 Feisty. Apache directives used to
>> >> > load
>> >> > mod_python.psp:
>> >> >
>> >> > <Directory /var/www-sec/st/>
>> >> >     AddHandler mod_python .psp .psp_
>> >> >     PythonHandler mod_python.psp
>> >> >     PythonDebug On
>> >> > </Directory>
>> >> >
>> >> > I also tried using PSP through PublisherHandler. Same thing, the
>> >> > run()
>> >> > method of the psp.PSP instance returns nothing:
>> >> >
>> >> > #!/usr/bin/env python
>> >> > from mod_python import apache,psp
>> >> >
>> >> >
>> >> > def handler(req):
>> >> >   req.content_type = 'text/html'
>> >> >   template = psp.PSP(req, filename='/var/www/st/test.psp')
>> >> >   #req.write("%s" % template.run())
>> >> >   template.run({'what':'hello'})
>> >> >   req.flush()
>> >> >   return apache.OK
>> >> >
>> >> > _______________________________________________
>> >> > Mod_python mailing list
>> >> > Mod_python at modpython.org
>> >> > http://mailman.modpython.org/mailman/listinfo/mod_python
>> >> >
>> >
>> >
>
>


More information about the Mod_python mailing list