mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #19802 -- Fixed HttpResponse.set_cookie() with unicode data on Python 2.
Thanks django at patrickbregman.eu for the report.
This commit is contained in:
@@ -13,7 +13,7 @@ from django.core.exceptions import DisallowedRedirect
|
||||
from django.core.serializers.json import DjangoJSONEncoder
|
||||
from django.http.cookie import SimpleCookie
|
||||
from django.utils import six, timezone
|
||||
from django.utils.encoding import force_bytes, force_text, iri_to_uri
|
||||
from django.utils.encoding import force_bytes, force_text, force_str, iri_to_uri
|
||||
from django.utils.http import cookie_date
|
||||
from django.utils.six.moves import map
|
||||
from django.utils.six.moves.urllib.parse import urlparse
|
||||
@@ -221,6 +221,7 @@ class HttpResponseBase(six.Iterator):
|
||||
If it is a ``datetime.datetime`` object then ``max_age`` will be calculated.
|
||||
|
||||
"""
|
||||
value = force_str(value)
|
||||
self.cookies[key] = value
|
||||
if expires is not None:
|
||||
if isinstance(expires, datetime.datetime):
|
||||
|
||||
Reference in New Issue
Block a user