From fc364cca7d406464d09cb628756d81dc52a4204d Mon Sep 17 00:00:00 2001 From: "Paul J. Davis" Date: Thu, 26 Jun 2014 14:31:40 -0500 Subject: [PATCH] Fix check for file-like objects The `is_fileobject()` function in utils.py would break when the respones was a wrapped `HTTPResponse`'s `raw` attribute. This just adds the `IOError` exception type to the `is_fileobject()` function so that the response can be streamed normally. Fixes #805 --- gunicorn/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gunicorn/util.py b/gunicorn/util.py index 9ef79a3a..b7d3a67a 100644 --- a/gunicorn/util.py +++ b/gunicorn/util.py @@ -515,7 +515,7 @@ def is_fileobject(obj): # check BytesIO case and maybe others try: obj.fileno() - except io.UnsupportedOperation: + except (IOError, io.UnsupportedOperation): return False return True