[mod_python] Render a template (PSP)

Graham Dumpleton grahamd at dscpl.com.au
Mon Oct 2 18:10:33 EDT 2006


The write() methods needs to take a second argument, so using StringIO
directly may not work. Instead see:

  http://www.modpython.org/pipermail/mod_python/2005-June/018231.html

Graham

Mike Looijmans wrote ..
> You may be able to get away with this:
> 
> 
>   grabber = StringIO()
>   oldwrite = req.write
>   req.write = grabber.write
>   try:
>       doSomePSPStuff(req)
>   finally:
>       req.write = oldwrite
> 
> 
> This would redirect any output in the doSomePSPStuff function into the
> grabber object.
> 
> --
> Mike Looijmans
> Philips Natlab / Topic Automation
> 
> 
> durumdara wrote:
> > I want to only render a PSP template to insert to another PSP-s, I don't
> > want to write to the output stream !
> > How to I redirect psp's output to get the rendered text ?
> 
> _______________________________________________
> 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