From d100de91eaf8cb22dc51670d8bad4fec9c87d8e8 Mon Sep 17 00:00:00 2001
From: Helmut Grohne <helmut@subdivi.de>
Date: Sat, 31 Jan 2009 19:55:18 +0100
Subject: StaticFile uses wsgi.file_wrapper from environ if possible

---
 wsgitools/applications.py | 3 +++
 1 file changed, 3 insertions(+)

(limited to 'wsgitools')

diff --git a/wsgitools/applications.py b/wsgitools/applications.py
index 33823bd..f90e395 100644
--- a/wsgitools/applications.py
+++ b/wsgitools/applications.py
@@ -127,6 +127,9 @@ class StaticFile:
                 stream.close()
             return []
 
+        if isinstance(self.filelike, basestring) and 'wsgi.file_wrapper' in environ:
+            return environ['wsgi.file_wrapper'](stream, self.blocksize)
+
         if 0 <= size <= self.blocksize:
             data = stream.read(size)
             if isinstance(self.filelike, basestring):
-- 
cgit v1.2.3