Created
October 25, 2012 12:26
-
-
Save ods/3952302 to your computer and use it in GitHub Desktop.
Webob patch: Fixed condition for adding charset parameter to Content-Type header
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -r df324794a581 -r c59f41d443d3 third-party/webob/response.py | |
--- a/third-party/webob/response.py Wed Oct 24 19:28:50 2012 +0400 | |
+++ b/third-party/webob/response.py Thu Oct 25 16:29:29 2012 +0400 | |
@@ -115,16 +115,11 @@ | |
charset = None | |
if 'charset' in kw: | |
charset = kw.pop('charset') | |
- elif self.default_charset: | |
- if (content_type | |
+ elif (self.default_charset | |
+ and content_type | |
and 'charset=' not in content_type | |
- and (content_type == 'text/html' | |
- or content_type.startswith('text/') | |
- or content_type.startswith('application/xml') | |
- or content_type.startswith('application/json') | |
- or (content_type.startswith('application/') | |
- and (content_type.endswith('+xml') or content_type.endswith('+json'))))): | |
- charset = self.default_charset | |
+ and content_type.startswith('text/')): | |
+ charset = self.default_charset | |
if content_type and charset: | |
content_type += '; charset=' + charset | |
elif self._headerlist and charset: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment