diff options
| author | Tim Graham <timograham@gmail.com> | 2016-03-14 10:24:51 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-03-14 18:58:49 -0400 |
| commit | 59df07738c05db85f5cfb8da61d3ec36c2a55987 (patch) | |
| tree | fd323ed16f6e4176db87e060a2b1e6618e2fd726 /django/http | |
| parent | 2f81f466a89ca07ee9860371b12d3c7376d9b615 (diff) | |
Simplified _cookie_allows_colon_in_names condition.
Diffstat (limited to 'django/http')
| -rw-r--r-- | django/http/cookie.py | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/django/http/cookie.py b/django/http/cookie.py index 2714a30638..344e59661f 100644 --- a/django/http/cookie.py +++ b/django/http/cookie.py @@ -6,13 +6,8 @@ from django.utils import six from django.utils.encoding import force_str from django.utils.six.moves import http_cookies -# See ticket #13007, http://bugs.python.org/issue2193 and http://trac.edgewall.org/ticket/2256 -_tc = http_cookies.SimpleCookie() -try: - _tc.load(str('foo:bar=1')) - _cookie_allows_colon_in_names = True -except http_cookies.CookieError: - _cookie_allows_colon_in_names = False +# http://bugs.python.org/issue2193 is fixed in Python 3.3+. +_cookie_allows_colon_in_names = six.PY3 # Cookie pickling bug is fixed in Python 2.7.9 and Python 3.4.3+ # http://bugs.python.org/issue22775 @@ -40,7 +35,7 @@ else: if not _cookie_allows_colon_in_names: def load(self, rawdata): self.bad_cookies = set() - if six.PY2 and isinstance(rawdata, six.text_type): + if isinstance(rawdata, six.text_type): rawdata = force_str(rawdata) super(SimpleCookie, self).load(rawdata) for key in self.bad_cookies: |
