mirror of
https://github.com/django/django.git
synced 2024-12-26 02:56:25 +00:00
[py3] Used smart_str to prevent regressions in http handling
This commit is contained in:
parent
f10a1b0641
commit
09c589810d
@ -61,14 +61,14 @@ else:
|
|||||||
if not _cookie_allows_colon_in_names:
|
if not _cookie_allows_colon_in_names:
|
||||||
def load(self, rawdata):
|
def load(self, rawdata):
|
||||||
self.bad_cookies = set()
|
self.bad_cookies = set()
|
||||||
super(SimpleCookie, self).load(str(rawdata))
|
super(SimpleCookie, self).load(smart_str(rawdata))
|
||||||
for key in self.bad_cookies:
|
for key in self.bad_cookies:
|
||||||
del self[key]
|
del self[key]
|
||||||
|
|
||||||
# override private __set() method:
|
# override private __set() method:
|
||||||
# (needed for using our Morsel, and for laxness with CookieError
|
# (needed for using our Morsel, and for laxness with CookieError
|
||||||
def _BaseCookie__set(self, key, real_value, coded_value):
|
def _BaseCookie__set(self, key, real_value, coded_value):
|
||||||
key = str(key)
|
key = smart_str(key)
|
||||||
try:
|
try:
|
||||||
M = self.get(key, Morsel())
|
M = self.get(key, Morsel())
|
||||||
M.set(key, real_value, coded_value)
|
M.set(key, real_value, coded_value)
|
||||||
@ -85,7 +85,7 @@ from django.core.files import uploadhandler
|
|||||||
from django.http.multipartparser import MultiPartParser
|
from django.http.multipartparser import MultiPartParser
|
||||||
from django.http.utils import *
|
from django.http.utils import *
|
||||||
from django.utils.datastructures import MultiValueDict, ImmutableList
|
from django.utils.datastructures import MultiValueDict, ImmutableList
|
||||||
from django.utils.encoding import smart_bytes, iri_to_uri, force_text
|
from django.utils.encoding import smart_bytes, smart_str, iri_to_uri, force_text
|
||||||
from django.utils.http import cookie_date
|
from django.utils.http import cookie_date
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
@ -137,7 +137,7 @@ def build_request_repr(request, path_override=None, GET_override=None,
|
|||||||
except:
|
except:
|
||||||
meta = '<could not parse>'
|
meta = '<could not parse>'
|
||||||
path = path_override if path_override is not None else request.path
|
path = path_override if path_override is not None else request.path
|
||||||
return str('<%s\npath:%s,\nGET:%s,\nPOST:%s,\nCOOKIES:%s,\nMETA:%s>' %
|
return smart_str('<%s\npath:%s,\nGET:%s,\nPOST:%s,\nCOOKIES:%s,\nMETA:%s>' %
|
||||||
(request.__class__.__name__,
|
(request.__class__.__name__,
|
||||||
path,
|
path,
|
||||||
six.text_type(get),
|
six.text_type(get),
|
||||||
|
Loading…
Reference in New Issue
Block a user