Hi Tom,

On 02/23/2012 06:07 AM, Tom Christie wrote:
> I see that as of 1.4 `HttpRequest.raw_post_data` is being marked as
> "pending deprecation", and `HttpRequest.body` has been introduced.
> This still leaves us with two ways to get at the request body - `.body`
> and `.read()`
> 
> If we're going to make the change of marking `raw_post_data` as deprecated,
> wouldn't it make sense to only have a single interface to getting the
> request body,
> rather than two different interfaces which behave in subtly different ways?
> 
> For example, we could also mark '.read()' as pending deprecation, and
> just have 'body' be a stream-like object.

Well, the reason .read() exists is because a design decision was made
long ago that HttpRequest objects should provide a file-like interface
(thus also .readline(), .readlines(), and .xreadlines()). Short of
reversing that decision (which isn't going to happen, given its long
history), deprecating .read() is not an option. And I wouldn't be in
favor of removing .body, which is the obvious HTTP-oriented name for the
request body.

I don't really see the presence of both as a problem. The "body"
attribute is the primary, and simplest, way to just get the full body of
the response. "read" is present only so that a request can be treated
like a file object.

Carl

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to