Ticket #18340: 18340.diff

File 18340.diff, 1.4 KB (added by Claude Paroz, 13 years ago)

Do not use cPickle

  • django/contrib/formtools/tests/__init__.py

    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):  
    156156
    157157
    158158class FormHmacTests(unittest.TestCase):
    159     """
    160     Same as SecurityHashTests, but with form_hmac
    161     """
    162159
    163160    def test_textfield_hash(self):
    164161        """
    class FormHmacTests(unittest.TestCase):  
    166163        leading/trailing whitespace so as to be friendly to broken browsers that
    167164        submit it (usually in textareas).
    168165        """
    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.  '})
    171168        hash1 = utils.form_hmac(f1)
    172169        hash2 = utils.form_hmac(f2)
    173170        self.assertEqual(hash1, hash2)
  • django/contrib/formtools/utils.py

    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)
     2import pickle
    53
    64from django.utils.crypto import salted_hmac
    75
Back to Top