Create a copy in the validator's self.document
This ensures that further modifications (like setting '_etag' etc.) aren't done in-place.
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import copy
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
@@ -24,8 +25,9 @@ class ValidateCustomFields(Validator):
|
|||||||
result = super().validate(document, *args, **kwargs)
|
result = super().validate(document, *args, **kwargs)
|
||||||
|
|
||||||
# Store the in-place modified document as self.document, so that Eve's post_internal
|
# Store the in-place modified document as self.document, so that Eve's post_internal
|
||||||
# can actually pick it up as the validated document.
|
# can actually pick it up as the validated document. We need to make a copy so that
|
||||||
self.document = document
|
# further modifications (like setting '_etag' etc.) aren't done in-place.
|
||||||
|
self.document = copy.deepcopy(document)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user