I cannot reproduce this:

>>> IS_EMAIL()('x')
('x', 'enter a valid email address')
>>> IS_EMAIL()('x...@x.com')
('x...@x.com', None)
>>> IS_LIST_OF(IS_EMAIL())(['x'])
(['x'], 'enter a valid email address')
>>> IS_LIST_OF(IS_EMAIL())(['x...@x.com'])
(['x...@x.com'], None)
>>> IS_LIST_OF(IS_EMAIL())(['x#x.com'])
(['x#x.com'], 'enter a valid email address')

can your print form.errors? Perhaps this is a problem with the widget and 
not the validator.

On Saturday, 15 September 2012 13:08:50 UTC-5, mweissen wrote:
>
> I have a simple table, one name and a list of email-addresses:
>
> db.define_table('address',
>     Field('name'),
>     Field('emails','list:string', requires=IS_LIST_OF(IS_EMAIL())))
>
> Now I add one name and two email-addresses to this table.
>
> Id:      1
> Name:    Smith
> Emails:  jsm...@example.com <javascript:>
>          j...@example.com <javascript:>
>
> Everything looks fine.
>
> But if there is an error in the email-address (which is catched by the 
> validator), a lot goes wrong:
> Both email-addresses are converted to a list; this list is doubled and ...
>
> Id:      1
> Name:    Smith
> Emails:  ['jsmith*#*example.com', 'j...@example.com <javascript:>']
>          ['jsmith#example.com', 'j...@example.com <javascript:>']
>
> ... there is no error message!
>
> Now I have changed the model to
>
> db.define_table('address',
>     Field('name'),
>     Field('emails','list:string', requires=IS_EMAIL()))
>
> but this model does not detect the wrong email address.
>
> What is the right way to use a validator with a list of strings?
>
> Regards, Martin
>

-- 



Reply via email to