From 460666db65657c35ba894e3c322d24dc1694fea1 Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Tue, 26 Sep 2017 09:53:42 +0200 Subject: [PATCH] Add docstring for `CustomValidatorMessage` --- rest_framework/compat.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rest_framework/compat.py b/rest_framework/compat.py index c3d100c76..e0f718ced 100644 --- a/rest_framework/compat.py +++ b/rest_framework/compat.py @@ -299,6 +299,12 @@ except ImportError: DecimalValidator = None class CustomValidatorMessage(object): + """ + We need to avoid evaluation of `lazy` translated `message` in `django.core.validators.BaseValidator.__init__`. + https://github.com/django/django/blob/75ed5900321d170debef4ac452b8b3cf8a1c2384/django/core/validators.py#L297 + + Ref: https://github.com/encode/django-rest-framework/pull/5452 + """ def __init__(self, *args, **kwargs): self.message = kwargs.pop('message', self.message) super(CustomValidatorMessage, self).__init__(*args, **kwargs)