mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #23895 -- Prevented pickling of ResolverMatch.
Pickling a ResolverMatch did not work correctly in many cases, especially with CBVs and URLResolvers in the list of tried URL paths.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"""
|
||||
Unit tests for reverse URL lookups.
|
||||
"""
|
||||
import pickle
|
||||
import sys
|
||||
import threading
|
||||
|
||||
@@ -1167,6 +1168,12 @@ class ResolverMatchTests(SimpleTestCase):
|
||||
f"route='{name}/')",
|
||||
)
|
||||
|
||||
@override_settings(ROOT_URLCONF='urlpatterns.path_urls')
|
||||
def test_pickling(self):
|
||||
msg = 'Cannot pickle ResolverMatch.'
|
||||
with self.assertRaisesMessage(pickle.PicklingError, msg):
|
||||
pickle.dumps(resolve('/users/'))
|
||||
|
||||
|
||||
@override_settings(ROOT_URLCONF='urlpatterns_reverse.erroneous_urls')
|
||||
class ErroneousViewTests(SimpleTestCase):
|
||||
|
||||
Reference in New Issue
Block a user