Though that breaks backward compatibility, as the interface for custom 
validators is provided in the official documentation.

On Friday, April 5, 2019 at 2:07:22 PM UTC-4, Leonel Câmara wrote:
>
> The way validators are in 2.18.4 you need to do it like this:
>
>
> class IS_MEMBERSHIP_YEAR_END(Validator)
> :
>     def __init__(self, error_message='Not a membership year end'):
>         self.error_message = error_message
>
>     def validate(self, value):
>         yearend = datetime.date(2018,9,30)
>         if value.month==yearend.month and value.day==yearend.day:
>             return value
>         else:
>             raise ValidationError(self.translator(self.error_message))
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to