summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Merickel <michael@merickel.org>2014-05-16 21:34:02 -0500
committerMichael Merickel <michael@merickel.org>2014-05-16 21:42:02 -0500
commit745edec7be7c4c4be56cbdf01ffe3543cb3348e2 (patch)
treee2eca149f01eb96e7b2fad856624bddb59fd2ff9
parentc8a58abb1ed5705defb7d7464e4f0d086fe13a21 (diff)
downloadpyramid-745edec7be7c4c4be56cbdf01ffe3543cb3348e2.tar.gz
pyramid-745edec7be7c4c4be56cbdf01ffe3543cb3348e2.tar.bz2
pyramid-745edec7be7c4c4be56cbdf01ffe3543cb3348e2.zip
close resources and 80-char line width
-rw-r--r--pyramid/response.py3
-rw-r--r--pyramid/tests/test_response.py6
2 files changed, 6 insertions, 3 deletions
diff --git a/pyramid/response.py b/pyramid/response.py
index 6b5f0a561..adc903b44 100644
--- a/pyramid/response.py
+++ b/pyramid/response.py
@@ -53,7 +53,8 @@ class FileResponse(Response):
def __init__(self, path, request=None, cache_max_age=None,
content_type=None, content_encoding=None):
if content_type is None:
- content_type, content_encoding = mimetypes.guess_type(path, strict=False)
+ content_type, content_encoding = (
+ mimetypes.guess_type(path, strict=False))
if content_type is None:
content_type = 'application/octet-stream'
super(FileResponse, self).__init__(
diff --git a/pyramid/tests/test_response.py b/pyramid/tests/test_response.py
index 8061ecac5..8731fa764 100644
--- a/pyramid/tests/test_response.py
+++ b/pyramid/tests/test_response.py
@@ -25,7 +25,7 @@ class TestFileResponse(unittest.TestCase):
def _getPath(self, suffix='txt'):
here = os.path.dirname(__file__)
- return os.path.join(here, 'fixtures', 'minimal.%s'%(suffix,))
+ return os.path.join(here, 'fixtures', 'minimal.%s' % (suffix,))
def test_with_image_content_type(self):
path = self._getPath('jpg')
@@ -33,12 +33,14 @@ class TestFileResponse(unittest.TestCase):
self.assertEqual(r.content_type, 'image/jpeg')
self.assertEqual(r.headers['content-type'], 'image/jpeg')
path = self._getPath()
+ r.app_iter.close()
def test_with_xml_content_type(self):
path = self._getPath('xml')
r = self._makeOne(path, content_type='application/xml')
self.assertEqual(r.content_type, 'application/xml')
- self.assertEqual(r.headers['content-type'], 'application/xml; charset=UTF-8')
+ self.assertEqual(r.headers['content-type'],
+ 'application/xml; charset=UTF-8')
r.app_iter.close()
def test_with_pdf_content_type(self):