def validate(self, instance, value): #pylint: disable=unused-argument,no-self-use
"""Check if the value is valid for the Property
If valid, return the value, possibly coerced from the input value.
If invalid, a ValueError is raised.
.. warning::
Calling :code:`validate` again on a coerced value must not modify
the value further.
.. note::
This function should be able to handle :code:`instance=None`
since valid Property values are independent of containing
HasProperties class. However, the instance is passed to
:code:`error` for a more verbose error message, and it may be
used for additional optional validation.
"""
return value
评论列表
文章目录