Skip to content

Commit

Permalink
[py3] Made a small fix in django.http.
Browse files Browse the repository at this point in the history
This is necessary for the 'utils' tests to pass.
  • Loading branch information
aaugustin committed Aug 7, 2012
1 parent 9e0a10b commit bf4da7a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion django/http/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,12 @@ def _convert_to_ascii(self, *values):
for value in values:
if isinstance(value, six.text_type):
try:
value = value.encode('us-ascii')
if not six.PY3:
value = value.encode('us-ascii')
else:
# In Python 3, use a string in headers,
# but ensure in only contains ASCII characters.
value.encode('us-ascii')
except UnicodeError as e:
e.reason += ', HTTP response headers must be in US-ASCII format'
raise
Expand Down

0 comments on commit bf4da7a

Please sign in to comment.