hgweb: remove handling of any else than strings from request.write
authorMads Kiilerich <mads@kiilerich.com>
Tue, 15 Jan 2013 01:05:12 +0100
changeset 18350 c0d63e1884a3
parent 18349 c007e5c54b16
child 18351 3fbdbeab38cc
hgweb: remove handling of any else than strings from request.write Iterators should be returned WSGI style, not written. And apparently all of hgweb do that.
mercurial/hgweb/request.py
--- a/mercurial/hgweb/request.py	Tue Jan 15 01:05:12 2013 +0100
+++ b/mercurial/hgweb/request.py	Tue Jan 15 01:05:12 2013 +0100
@@ -105,16 +105,11 @@
             self.headers = []
 
     def write(self, thing):
-        if util.safehasattr(thing, "__iter__"):
-            for part in thing:
-                self.write(part)
-        else:
-            thing = str(thing)
-            try:
-                self.server_write(thing)
-            except socket.error, inst:
-                if inst[0] != errno.ECONNRESET:
-                    raise
+        try:
+            self.server_write(thing)
+        except socket.error, inst:
+            if inst[0] != errno.ECONNRESET:
+                raise
 
     def writelines(self, lines):
         for line in lines: