diff options
author | pjenvey <devnull@localhost> | 2009-03-02 01:08:05 +0000 |
---|---|---|
committer | pjenvey <devnull@localhost> | 2009-03-02 01:08:05 +0000 |
commit | 69c793c0b54259ea8b0f1e2200fb813c8defb7b8 (patch) | |
tree | 601c24a23e9d65b358970d98891fe1d6f6081fd4 /paste/httpheaders.py | |
parent | 7b180249432d6cd5e5a448a7a52dcd35b0668bfa (diff) | |
download | paste-69c793c0b54259ea8b0f1e2200fb813c8defb7b8.tar.gz |
workaround mimetype's incredible lameness:
http://bugs.python.org/issue5401
patch from chrisz
Diffstat (limited to 'paste/httpheaders.py')
-rw-r--r-- | paste/httpheaders.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/paste/httpheaders.py b/paste/httpheaders.py index 32e8147..093da68 100644 --- a/paste/httpheaders.py +++ b/paste/httpheaders.py @@ -134,9 +134,9 @@ dashes to give CamelCase style names. .. [3] http://www.python.org/peps/pep-0333.html#the-start-response-callable """ +import mimetypes import urllib2 import re -from mimetypes import guess_type from rfc822 import formatdate, parsedate_tz, mktime_tz from time import time as now from httpexceptions import HTTPBadRequest @@ -575,7 +575,7 @@ def normalize_headers(response_headers, strict=True): (key, val) = response_headers[idx] head = get_header(key, strict) if not head: - newhead = '-'.join([x.capitalize() for x in + newhead = '-'.join([x.capitalize() for x in key.replace("_","-").split("-")]) response_headers[idx] = (newhead, val) category[newhead] = 4 @@ -855,7 +855,7 @@ class _ContentDisposition(_SingleValueHeader): (result, filename) = self._compose(**kwargs) mimetype = CONTENT_TYPE(collection) if filename and (not mimetype or CONTENT_TYPE.UNKNOWN == mimetype): - mimetype, _ = guess_type(filename) + mimetype, _ = mimetypes.guess_type(filename) if mimetype and CONTENT_TYPE.UNKNOWN != mimetype: CONTENT_TYPE.update(collection, mimetype) self.update(collection, *result) |