◐ Shell
clean mode source ↗

Message 123038 - Python tracker

On Wed, Dec 01, 2010 at 10:06:25AM +0000, Antoine Pitrou wrote:
> +        try:
> +           self.sock.sendall(data)
> 
> Indentation problem here.

I could notice it now. Shall fix it.

> 
> +                if isinstance(data,str):
> +                    content_length = len(data)
> 
> I'm not sure I understand. What does sending an unicode string mean?

That's my mistake with understanding, I just realized (again) that
socket.send, socket.sendall does only bytes. And we don't encode the
unicode code string to send as bytes too.

> +        def iterable_body():
> +            yield "one"
> +            yield "two"
> +            yield "three"
> 
> Iterables of strings? this doesn't seem supported in the patch.

It should be:

+            yield b"one"
+            yield b"two"
+            yield b"three"