Discussion:
[FE-discuss] messages are awkward for formencode.validators.NotEmpty
Jonathan Vanasco
2009-02-22 23:22:47 UTC
Permalink
i don't know if this is because docs or a changing config, but...

- i created a formencode.validators.NotEmpty instance
- i kept getting "Missing Value" errors that i needed to customize
- the class itself has this:

messages = {
'empty': _("Please enter a value"),
}

which didn't make since, because I wasn't getting that error.

so i tried
is_tos= formencode.validators.NotEmpty( messages={ 'empty': 'You
must check this box to register' })

that didn't work.

searching all of Formencode, i got the idea to try this:
is_tos= formencode.validators.NotEmpty( messages={ 'empty':
'You must check this box to register.', 'missingValue': 'You must
check this box to register..' } )

that didn't work either.

looking at the changelog, i finally figured out how to customize that
error:
is_tos= formencode.validators.NotEmpty( messages={ 'empty':
'You must check this box to register.', 'missingValue': 'You must
check this box to register..' , 'missing': 'You must check this box
to register...' } )

it would be nice if things were a bit more straightforward.

is the empty ever called for the NotEmpty ? should that just be
'missing' ?

Loading...