From 22bae974cf49a80fd60bfe51b110ee00e91e729b Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 20 Feb 2012 21:27:19 -0500 Subject: - The static file response object used by ``config.add_static_view`` opened the static file twice, when it only needed to open it once. --- CHANGES.txt | 6 ++++++ pyramid/static.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index e8b2326e4..8595e726e 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -28,6 +28,12 @@ Backwards Incompatibilities - The ``pyramid.registry.noop_introspector`` API object has been removed. +Bug Fixes +--------- + +- The static file response object used by ``config.add_static_view`` opened + the static file twice, when it only needed to open it once. + 1.3a8 (2012-02-19) ================== diff --git a/pyramid/static.py b/pyramid/static.py index 8788d016d..e91485fad 100644 --- a/pyramid/static.py +++ b/pyramid/static.py @@ -68,7 +68,7 @@ class _FileResponse(Response): if 'wsgi.file_wrapper' in environ: app_iter = environ['wsgi.file_wrapper'](f, _BLOCK_SIZE) else: - app_iter = _FileIter(open(path, 'rb'), _BLOCK_SIZE) + app_iter = _FileIter(f, _BLOCK_SIZE) self.app_iter = app_iter # assignment of content_length must come after assignment of app_iter self.content_length = content_length -- cgit v1.2.3