Mercurial > moin > 1.9
changeset 4223:bb25a59b5542
Implemented missing .send_file method
author | Florian Krupicka <florian.krupicka@googlemail.com> |
---|---|
date | Tue, 15 Jul 2008 20:05:15 +0200 |
parents | f77469d98cd2 |
children | 31fb12b2deb5 |
files | MoinMoin/web/contexts.py |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/MoinMoin/web/contexts.py Tue Jul 15 19:57:14 2008 +0200 +++ b/MoinMoin/web/contexts.py Tue Jul 15 20:05:15 2008 +0200 @@ -18,6 +18,7 @@ from MoinMoin.formatter import text_html from MoinMoin.theme import load_theme_fallback from MoinMoin.util.clock import Clock +from MoinMoin.request import MoinMoinFinish from MoinMoin.web.request import Request from MoinMoin.web.utils import check_spider, UniqueIDGenerator from MoinMoin.web.exceptions import Forbidden, SurgeProtection @@ -178,7 +179,11 @@ # implementation of methods expected by RequestBase def send_file(self, fileobj, bufsize=8192, do_flush=None): - pass + def simple_wrapper(fileobj, bufsize): + return iter(lambda: fileobj.read(bufsize), '') + file_wrapper = self.environ.get('wsgi.file_wrapper', simple_wrapper) + self.response = file_wrapper(request._send_file, request._send_bufsize) + raise MoinMoinFinish('sent file') def read(self, n=None): if n is None: