Permalink
Browse files

Fixed #18403 -- Solved problem with redefined SimpleCookie with inval…

…id cookie name.
  • Loading branch information...
1 parent 0e18fb0 commit e1d779dfac1b5e9e90f621b65971a71b63305379 @hirokiky committed Feb 23, 2013
Showing with 4 additions and 1 deletion.
  1. +4 −1 django/http/cookie.py
View
@@ -48,7 +48,8 @@ def value_encode(self, val):
if not _cookie_allows_colon_in_names:
def load(self, rawdata):
- self.bad_cookies = set()
+ if not hasattr(self, 'bad_cookies'):
+ self.bad_cookies = set()
if not six.PY3 and isinstance(rawdata, six.text_type):
rawdata = force_str(rawdata)
super(SimpleCookie, self).load(rawdata)
@@ -64,6 +65,8 @@ def _BaseCookie__set(self, key, real_value, coded_value):
M.set(key, real_value, coded_value)
dict.__setitem__(self, key, M)
except http_cookies.CookieError:
+ if not hasattr(self, 'bad_cookies'):
+ self.bad_cookies = set()
self.bad_cookies.add(key)
dict.__setitem__(self, key, http_cookies.Morsel())

0 comments on commit e1d779d

Please sign in to comment.