summaryrefslogtreecommitdiff
path: root/paste/wsgiwrappers.py
diff options
context:
space:
mode:
authorpjenvey <devnull@localhost>2007-10-04 03:21:03 +0000
committerpjenvey <devnull@localhost>2007-10-04 03:21:03 +0000
commitc028640cf084681d233e434d9350ab7beb9a9eaa (patch)
tree202e06e4ec374e85144b7f67bb3e3666dc3414b3 /paste/wsgiwrappers.py
parent129b7e35c40d58f8d3632faa1dac9c99f0a08776 (diff)
downloadpaste-c028640cf084681d233e434d9350ab7beb9a9eaa.tar.gz
r6823 forgot _CHARSET_RE from WebOb and broke WSGIResponse's
content-type when charset was assigned
Diffstat (limited to 'paste/wsgiwrappers.py')
-rw-r--r--paste/wsgiwrappers.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/paste/wsgiwrappers.py b/paste/wsgiwrappers.py
index a4b68de..51e556e 100644
--- a/paste/wsgiwrappers.py
+++ b/paste/wsgiwrappers.py
@@ -20,7 +20,7 @@ from paste.util.mimeparse import desired_matches
__all__ = ['WSGIRequest', 'WSGIResponse']
-_CHARSET_RE = re.compile(r'.*;\s*charset=(.*?)(;|$)', re.I)
+_CHARSET_RE = re.compile(r';\s*charset=([^;]*)', re.I)
class DeprecatedSettings(StackedObjectProxy):
def _push_object(self, obj):
@@ -257,7 +257,7 @@ class WSGIRequest(object):
Determine the encoding as specified by the browser via the
Content-Type's charset parameter, if one is set
"""
- charset_match = _CHARSET_RE.match(self.headers.get('Content-Type', ''))
+ charset_match = _CHARSET_RE.search(self.headers.get('Content-Type', ''))
if charset_match:
return charset_match.group(1)
@@ -364,7 +364,7 @@ class WSGIResponse(object):
Determine the encoding as specified by the Content-Type's charset
parameter, if one is set
"""
- charset_match = _CHARSET_RE.match(self.headers.get('Content-Type', ''))
+ charset_match = _CHARSET_RE.search(self.headers.get('Content-Type', ''))
if charset_match:
return charset_match.group(1)
@@ -481,7 +481,7 @@ class WSGIResponse(object):
header = self.headers.pop('content-type')
except KeyError:
raise AttributeError(
- "You cannot set the charset when on content-type is defined")
+ "You cannot set the charset when no content-type is defined")
match = _CHARSET_RE.search(header)
if match:
header = header[:match.start()] + header[match.end():]