Michael Merickel
2014-05-17 d8751c3c54ca2ea01b9cddbba0f6de75d06bf8c9
close resources and 80-char line width
2 files modified
9 ■■■■■ changed files
pyramid/response.py 3 ●●●● patch | view | raw | blame | history
pyramid/tests/test_response.py 6 ●●●●● patch | view | raw | blame | history
pyramid/response.py
@@ -53,7 +53,8 @@
    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__(
pyramid/tests/test_response.py
@@ -25,7 +25,7 @@
    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 @@
        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):