cgi "print statement" in multithreaded enviroment?
vegetax
vegeta.z at gmail.com
Mon May 2 20:24:02 EDT 2005
Irmen de Jong wrote:
> vegetax wrote:
>> How can i use cgi'like print statement in a multitreaded web framework?
>> each thread has its own Servlet instance with request/response objects,
>> sys.stdout = self.response(which is a file like object) wont work because
>> all threads will set the same file object and it will be a concurrence
>> mess.
>>
>> I am out of ideas here,so any hacks welcome =)
>>
>
> instead of:
>
> print "<html>.....</html>
>
> do:
>
> print >>self.response, "<html>....</html>"
>
>
> --Irmen
But i want to use "print" as a commodity feature, print >>
self.response,'html..' is longer to type than
self.response.write('html..')
The only clear way i am thinking right now is to write a preprocessor ,like
quixote ptl,but thats sloww
More information about the Python-list
mailing list