Patch[2] for http_response.py for quixote-2.1 (_encode_chunk)

Damjan <[email protected]>
Newsgroups gmane.comp.web.quixote.user
Message-ID <[email protected]>
This patch for Quixote-2.1/http_response.py changes the
HTTPResponse._encode_chunk method to only call the .encode method on
unciode objects, otherwise assume the programer knows what he does and
just send the byte string as is.

-- 
damjan | дамјан
This is my jabber ID --> [email protected] <-- not my mail address!!!

_______________________________________________
Quixote-users mailing list
[email protected]
http://mail.mems-exchange.org/mailman/listinfo/quixote-users
http_response-2.patch (text/plain, 595 B)
--- http_response.py-old	2005-08-21 16:53:11.000000000 +0200
+++ http_response.py	2005-08-21 16:50:40.000000000 +0200
@@ -220,10 +220,10 @@
     def _encode_chunk(self, chunk):
         """(chunk : str | unicode) -> str
         """
-        if self.charset == 'iso-8859-1' and isinstance(chunk, str):
-            return chunk # non-ASCII chars are okay
-        else:
+        if isinstance(chunk, unicode):
             return chunk.encode(self.charset)
+        else:
+            return chunk # non-ASCII chars are okay
 
     def _compress_body(self, body):
         """(body: str) -> str
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.