mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-04 20:40:14 +03:00
Fix for #3863: validators are not thread safe
https://github.com/tomchristie/django-rest-framework/issues/3863
This commit is contained in:
parent
909a3e80a1
commit
56f53a48bf
|
@ -491,6 +491,9 @@ class Field(object):
|
||||||
errors = []
|
errors = []
|
||||||
for validator in self.validators:
|
for validator in self.validators:
|
||||||
if hasattr(validator, 'set_context'):
|
if hasattr(validator, 'set_context'):
|
||||||
|
# Need to make a copy, because validator instances often
|
||||||
|
# are initialised globally
|
||||||
|
validator = copy.deepcopy(validator)
|
||||||
validator.set_context(self)
|
validator.set_context(self)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user