diff options
author | ianb <devnull@localhost> | 2005-10-04 23:16:17 +0000 |
---|---|---|
committer | ianb <devnull@localhost> | 2005-10-04 23:16:17 +0000 |
commit | 8ae5eedc501d18c0f5fb47611ff5fd0ff2e34b24 (patch) | |
tree | a40bf06b90376a2514d646278f0365bb434cf830 /paste/wsgilib.py | |
parent | 1af6a82f7e2f0618b021eaff326fb29946f553cb (diff) | |
download | paste-8ae5eedc501d18c0f5fb47611ff5fd0ff2e34b24.tar.gz |
Handle case where start_response is called multiple times (which happens during errors)
Diffstat (limited to 'paste/wsgilib.py')
-rw-r--r-- | paste/wsgilib.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/paste/wsgilib.py b/paste/wsgilib.py index 189c69d..22c768e 100644 --- a/paste/wsgilib.py +++ b/paste/wsgilib.py @@ -292,6 +292,8 @@ def send_file(filename): def application(environ, start_response): type, encoding = mimetypes.guess_type(filename) # @@: I don't know what to do with the encoding. + if not type: + type = 'application/octet-stream' size = os.stat(filename).st_size try: file = open(filename, 'rb') @@ -426,6 +428,8 @@ def capture_output(environ, start_response, application): data = [] output = StringIO() def replacement_start_response(status, headers, exc_info=None): + if data: + data[:] = [] data.append(status) data.append(headers) start_response(status, headers, exc_info) |