class IS_LIST(object):
    def __call__(self, value):
            mylist = value.split(",")
            for item in mylist:
                 val, error = IS_INT_IN_RANGE(0,10)(item)
                 if error:
                    return (val, error)
            return (mylist, None)


On Thu, Sep 8, 2011 at 11:44 PM, Noel Villamor <noe...@gmail.com> wrote:

>
> That worked!  Thanks Bruno.
>
> I wonder now if I can do further validation to ensure that all items
> are integers and in a specific range. In particular, I wanted to use
> the already available validator IS_INT_IN_RANGE. Something like:
>
> IS_LIST(IS_INT_IN_RANGE(0, 10))
>
> It is hacking time.
>
> :)
>
>
>
> On Sep 9, 2:21 pm, Bruno Rocha <rochacbr...@gmail.com> wrote:
> > May be there is a better way, but I should start with this:
> >
> > class IS_LIST(object):
> >     def __call__(self, value):
> >             mylist = value.split(",")
> >             return (mylist, None)
> >
> > Field("fld", "list:integer", widget=SQLFORM.widgets.string.widget,
> > requires=IS_LIST() )
> >
> > --
> > Bruno Rocha
> > [ About me:http://zerp.ly/rochacbruno]
>



-- 



--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]
[ Aprenda a programar: http://CursoDePython.com.br ]
[ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
[ Consultoria em desenvolvimento web: http://www.blouweb.com ]

Reply via email to