
Hi, On Tue, Jun 30, 2009 at 4:38 PM, Phil Mayers<p.mayers@imperial.ac.uk> wrote:
A file-like is a python-esque idiom. You can pass it to all kinds of things e.g. JSON parsers, XML parsers.
What if the body is a 1 gigabyte string? Do you want twisted to read the results in from the tempfile, instantiate a python string, and probably get killed due to an out-of-memory condition?
Ok, fair enough. I suppose what I was getting at as in general a nicer way to extract body content. I agree the file-like idiom is pythonic and probably better overall. I've just seen some annoying debugging sessions where seek wasn't being performed and reads yielding nothing - it's rather confusing when you get into that situation. I guess there's no magic bullet for that. In fact, I guess the real annoyance stems from the memory of finally figuring out that the body could be retrieved from request.content *in the first place* took far too long when I was learning twisted.web. But that's a different discussion entirely. Thanks, Reza -- Reza Lotun +44 (0)7521 310 763 rlotun@gmail.com