summaryrefslogtreecommitdiff
path: root/paste/httpexceptions.py
diff options
context:
space:
mode:
authorianb <devnull@localhost>2006-01-26 18:44:01 +0000
committerianb <devnull@localhost>2006-01-26 18:44:01 +0000
commit1e7152f6cd5ace9accb84323b8e28b2401e0b0d4 (patch)
tree0af84733562f40c570a89b0f30e6c838a45c3de0 /paste/httpexceptions.py
parent4122e6464bab2b2a16ad78258c24ef1f38b3d045 (diff)
downloadpaste-1e7152f6cd5ace9accb84323b8e28b2401e0b0d4.tar.gz
The last two commits fixed the wrong thing; urlparser now back to how it was, and fix httpexceptions.wsgi_application to not try to use dict methods on the header list
Diffstat (limited to 'paste/httpexceptions.py')
-rw-r--r--paste/httpexceptions.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/paste/httpexceptions.py b/paste/httpexceptions.py
index ccdf2f1..b61d8bc 100644
--- a/paste/httpexceptions.py
+++ b/paste/httpexceptions.py
@@ -224,18 +224,23 @@ class HTTPException(Exception):
This exception as a WSGI application
"""
if 'html' in environ.get('HTTP_ACCEPT',''):
- headers = {'content-type': 'text/html'}
+ headers = [('content-type', 'text/html')]
content = self.html(environ)
else:
- headers = {'content-type': 'text/plain'}
+ headers = [('content-type', 'text/plain')]
content = self.plain(environ)
if self.headers:
- headers.update(self.headers)
+ headers.extend(self.headers)
if isinstance(content, unicode):
content = content.encode('utf8')
- headers['content_type'] += '; charset=utf8'
+ cur_content_type = (
+ response.header_value(headers, 'content-type')
+ or 'text/html')
+ reponse.replace_header(
+ headers, 'content-type',
+ cur_content_type + '; charset=utf8')
start_response('%s %s' % (self.code, self.title),
- headers.items(),
+ headers,
exc_info)
return [content]