[mod_python] Question about PSP()

dharana dharana at dharana.net
Sat Jul 23 15:35:06 EDT 2005


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



More information about the Mod_python mailing list