diff --git a/django/http/cookie.py b/django/http/cookie.py
index 78adb09..50ff549 100644
a
|
b
|
|
1 | 1 | from __future__ import absolute_import, unicode_literals |
2 | 2 | |
3 | 3 | from django.utils.encoding import force_str |
| 4 | from django.utils import six |
4 | 5 | from django.utils.six.moves import http_cookies |
5 | 6 | |
6 | 7 | |
… |
… |
else:
|
48 | 49 | if not _cookie_allows_colon_in_names: |
49 | 50 | def load(self, rawdata): |
50 | 51 | self.bad_cookies = set() |
51 | | super(SimpleCookie, self).load(force_str(rawdata)) |
| 52 | if not six.PY3 and isinstance(rawdata, six.text_type): |
| 53 | rawdata = force_str(rawdata) |
| 54 | super(SimpleCookie, self).load(rawdata) |
52 | 55 | for key in self.bad_cookies: |
53 | 56 | del self[key] |
54 | 57 | |
diff --git a/tests/regressiontests/httpwrappers/tests.py b/tests/regressiontests/httpwrappers/tests.py
index 67172d9..c76d8ea 100644
a
|
b
|
class CookieTests(unittest.TestCase):
|
588 | 588 | c['name']['httponly'] = True |
589 | 589 | self.assertTrue(c['name']['httponly']) |
590 | 590 | |
| 591 | def test_load_dict(self): |
| 592 | c = SimpleCookie() |
| 593 | c.load({'name': 'val'}) |
| 594 | self.assertEqual(c['name'].value, 'val') |