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
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:
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
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
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:
>
>
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
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
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
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
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)
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
11 matches
Mail list logo