mirror of
https://github.com/django/django.git
synced 2025-09-18 16:30:01 +00:00
Fixed #16563 - Error pickling request.user
Thanks to zero.fuxor for the report git-svn-id: http://code.djangoproject.com/svn/django/trunk@17202 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
46c1d1551f
commit
655b29b5ba
2 changed files with 20 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
|||
import copy
|
||||
import pickle
|
||||
|
||||
from django.utils.unittest import TestCase
|
||||
from django.utils.functional import SimpleLazyObject, empty
|
||||
|
@ -96,3 +97,12 @@ class TestUtilsSimpleLazyObject(TestCase):
|
|||
self.assertTrue(x)
|
||||
x = SimpleLazyObject(lambda: 0)
|
||||
self.assertFalse(x)
|
||||
|
||||
def test_pickle_complex(self):
|
||||
# See ticket #16563
|
||||
x = SimpleLazyObject(complex_object)
|
||||
pickled = pickle.dumps(x)
|
||||
unpickled = pickle.loads(pickled)
|
||||
self.assertEqual(unpickled, x)
|
||||
self.assertEqual(unicode(unpickled), unicode(x))
|
||||
self.assertEqual(unpickled.name, x.name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue