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
         j...@example.com

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']
         ['jsmith#example.com', 'j...@example.com']

... 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