[mod_python] Question about PSP()

Graham Dumpleton grahamd at dscpl.com.au
Sat Jul 23 18:36:08 EDT 2005


Do you perhaps mean to use:

   reqwrap.getvalue()

instead of:

   reqwrap.read()

Graham

On 24/07/2005, at 5:35 AM, dharana wrote:

> btw, trying the req wrapper idea I wrote this:
>
>
>         from StringIO import StringIO
>
>         class reqwrapper(StringIO):
>             def write(self, s, *args):
>                 return StringIO.write(self, s)
>
>             def flush(self):
>                 pass
>
>         reqwrap = reqwrapper()
>         content_file = PSP(reqwrap, string=file_content)
>         content_file.run(self.vars)
>
>         logging.getLogger('app').debug('writen output: %s' % 
> reqwrap.read())
> 	self.req.write(reqwrap.read())
>
>
> it writtes nothing to either the real req object nor to the logging 
> system. I checked both the source of psp.py, requestobject.c and 
> StringIO.py and I can't see what I am failing to do.
>
> Thanks in advance,
>
>
> dharana wrote:
>> I have a PSP file witch, when generated, results in an html page with 
>> template placeholders like ${i18n_something}. I've been looking at 
>> psp.py and it seems that the only possibility will be to write a 
>> custom req object that captures all the output. Either that or to not 
>> generate output with template placeholders (I fear thinking about 
>> having to change this).
>> Do you see a better solution?
>
> -- 
> dharana
>
> _______________________________________________
> 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