[mod_python] PSP(req, string=None)

Graham Dumpleton grahamd at dscpl.com.au
Tue Jun 21 01:04:09 EDT 2005

dharana wrote ..
> PSP(req, string=None) won't print a blank page, it will try to load a file.
> Is 
> this intended behaviour?

If in doubt, always check the code:

        if not filename and not string:
            filename = req.filename

> from the doc:
> '''
> req is a request object; filename and string are optional keyword arguments
> which indicate the source of the PSP code. Only one of these can be specified.
> If neither is specified, req.filename is used as filename.
> '''
> I'm really specifying the string param.

You aren't really specifying it, as None is the default value
and special significance, in this evaluating to false.

But then, specifying an empty string will not help either as
that evaluates false as well. You would need:

  PSP(req, string=" ")

Ie., string consisting of 1 space.

> I came across this because I dynamically pass psp code to PSP and sometimes
> it's 
> a blank string instead of useful contents.

More information about the Mod_python mailing list