On Tue, Aug 26, 2003 at 06:34:51PM -0400, Neil Schemenauer wrote:
> Attached is a patch that implements my proposal. I didn't test the
> medusa and Twisted servers but I think the general idea is workable.
> Oleg and Graham, what do you think?
>
> Neil
Looks very good at first glance. I didn' t test it.
The only problem is: sometimes you use isinstance to test if it is a
stream, and sometimes you use types:
> + if type(self.body) is StringType:
> + file.write(self.body)
> + else:
> + # it's a stream
> + for chunk in self.body:
> + file.write(chunk)
Also the order of test... You are saying here "the body can be string or
non-string, and non-strings are streams, always". I would like to invert
the meaning: "the body can be stream or non-stream, and non-streams are
converted to strings, always":
if isinstance(self.body, Stream):
# it's a stream
for chunk in self.body:
file.write(chunk)
else:
file.write(str(self.body))
(there are few places like this in your patch...)
Oleg.
--
Oleg Broytmann http://phd.pp.ru/ phd@phd.pp.ru
Programmers don't die, they just GOSUB without RETURN.