[mod_python] Question about PSP()

Graham Dumpleton grahamd at dscpl.com.au
Sat Jul 23 18:52:42 EDT 2005


On 24/07/2005, at 8:43 AM, Bart wrote:

> On 7/23/05, Graham Dumpleton <grahamd at dscpl.com.au> wrote:
>> Do you perhaps mean to use:
>>
>>    reqwrap.getvalue()
>>
>> instead of:
>>
>>    reqwrap.read()
>>
>
> Can somebody explain to me what read() does since it doesn't read
> out data that is written? I have to say I find this rather 
> counterintuitive
> and have made the mistake a few times before I figured this out.

Read works when you supply the data to constructor of StringIO()
to begin with.

 >>> i=StringIO.StringIO("adsadsad")
 >>> i.read()
'adsadsad'


Graham



More information about the Mod_python mailing list