diff --git a/django/contrib/formtools/tests/__init__.py b/django/contrib/formtools/tests/__init__.py
index 88828e8..bf06846 100644
|
a
|
b
|
class PreviewTests(TestCase):
|
| 156 | 156 | |
| 157 | 157 | |
| 158 | 158 | class FormHmacTests(unittest.TestCase): |
| 159 | | """ |
| 160 | | Same as SecurityHashTests, but with form_hmac |
| 161 | | """ |
| 162 | 159 | |
| 163 | 160 | def test_textfield_hash(self): |
| 164 | 161 | """ |
| … |
… |
class FormHmacTests(unittest.TestCase):
|
| 166 | 163 | leading/trailing whitespace so as to be friendly to broken browsers that |
| 167 | 164 | submit it (usually in textareas). |
| 168 | 165 | """ |
| 169 | | f1 = HashTestForm({'name': 'joe', 'bio': 'Nothing notable.'}) |
| 170 | | f2 = HashTestForm({'name': ' joe', 'bio': 'Nothing notable. '}) |
| | 166 | f1 = HashTestForm({'name': u'joe', 'bio': u'Nothing notable.'}) |
| | 167 | f2 = HashTestForm({'name': u' joe', 'bio': u'Nothing notable. '}) |
| 171 | 168 | hash1 = utils.form_hmac(f1) |
| 172 | 169 | hash2 = utils.form_hmac(f2) |
| 173 | 170 | self.assertEqual(hash1, hash2) |
diff --git a/django/contrib/formtools/utils.py b/django/contrib/formtools/utils.py
index 572a096..96a0092 100644
|
a
|
b
|
|
| 1 | | try: |
| 2 | | import cPickle as pickle |
| 3 | | except ImportError: |
| 4 | | import pickle |
| | 1 | # Do not try cPickle here (see #18340) |
| | 2 | import pickle |
| 5 | 3 | |
| 6 | 4 | from django.utils.crypto import salted_hmac |
| 7 | 5 | |