custom validator fails : why ?

model:

class IS_LIST_TAGS:
    def __init__(self, separator=',', error_message='too many tags max=3 
tags!'):
        self.separator = separator
        self.e = error_message

    def __call__(self,value):
        try:
            li = value.split(self.separator)
            assert(len(li) <= 3)
            return (li, None)

db.define_table('listr',
                Field('tags','list:string',requires=[IS_NOT_EMPTY(), 
IS_LIST_TAGS()]))

controller:
                
def test():
    form = SQLFORM(db.listr)
    if form.process().accepted:
        response.flash = 'form accepted'
    elif form.errors:
        response.flash = 'form has errors'
    else:
        response.flash = 'please fill out the form'
    return dict(form=form)

-- 
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 Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to