[web2py] Re: Custom validator broken in 2.18.4, working in 2.17.2

2019-04-11 Thread tim . nyborg
The web2py book's example could use replacing, since it relies on using __init__ and returning (value, error) rather than using def validate and returning value or raising ValidationError On Sunday, 7 April 2019 05:36:13 UTC+1, Massimo Di Pierro wrote: > > we will fix the backward incompatibilit

[web2py] Re: Custom validator broken in 2.18.4, working in 2.17.2

2019-04-09 Thread David Manns
The original version works with 2.18.5 Thank you! On Thursday, April 4, 2019 at 4:52:37 PM UTC-4, David Manns wrote: > > The table in question has a field: > > Field('Paiddate', 'date', requires = [IS_EMPTY_OR(IS_DATE()), > IS_EMPTY_OR(IS_MEMBERSHIP_YEAR_END())]), > > The custom validator is:

[web2py] Re: Custom validator broken in 2.18.4, working in 2.17.2

2019-04-06 Thread Massimo Di Pierro
we will fix the backward incompatibility asap. Not intentional. On Saturday, 6 April 2019 12:12:47 UTC-7, David Manns wrote: > > PS this is not backward compatible to 2.17.2 > > On Thursday, April 4, 2019 at 4:52:37 PM UTC-4, David Manns wrote: >> >> The table in question has a field: >> >> Fi

[web2py] Re: Custom validator broken in 2.18.4, working in 2.17.2

2019-04-06 Thread Anthony
The book should be update, but we should also decide if we're OK breaking backward compatibility in this way. Anthony On Saturday, April 6, 2019 at 3:06:20 PM UTC-4, David Manns wrote: > > Changed my import to: > > from pydal.validators import Validator, ValidationError > > class IS_MEMBERSHIP_Y

[web2py] Re: Custom validator broken in 2.18.4, working in 2.17.2

2019-04-06 Thread David Manns
PS this is not backward compatible to 2.17.2 On Thursday, April 4, 2019 at 4:52:37 PM UTC-4, David Manns wrote: > > The table in question has a field: > > Field('Paiddate', 'date', requires = [IS_EMPTY_OR(IS_DATE()), > IS_EMPTY_OR(IS_MEMBERSHIP_YEAR_END())]), > > The custom validator is: > >

[web2py] Re: Custom validator broken in 2.18.4, working in 2.17.2

2019-04-06 Thread David Manns
Changed my import to: from pydal.validators import Validator, ValidationError 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

[web2py] Re: Custom validator broken in 2.18.4, working in 2.17.2

2019-04-06 Thread Leonel Câmara
Did you import ValidationError as well? -- 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

[web2py] Re: Custom validator broken in 2.18.4, working in 2.17.2

2019-04-06 Thread David Manns
The web2py book needs to be updated, as Anthony points out. As suggested I changed the validator to: 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): yearen

[web2py] Re: Custom validator broken in 2.18.4, working in 2.17.2

2019-04-05 Thread Anthony
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(Vali

[web2py] Re: Custom validator broken in 2.18.4, working in 2.17.2

2019-04-05 Thread Leonel Câmara
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)

[web2py] Re: Custom validator broken in 2.18.4, working in 2.17.2

2019-04-05 Thread David Manns
Created a ticket: https://github.com/web2py/web2py/issues/2170 On Thursday, April 4, 2019 at 4:52:37 PM UTC-4, David Manns wrote: > > The table in question has a field: > > Field('Paiddate', 'date', requires = [IS_EMPTY_OR(IS_DATE()), > IS_EMPTY_OR(IS_MEMBERSHIP_YEAR_END())]), > > The custom