Il 18/11/14 05:54, Massimo Di Pierro ha scritto:
> Problem is that IS_LIST_OF experts to validate a list. Instead you are
> passing "" (not a list) and None (also not a list).
> I agree that it is odd that interprets '' as [] and None as [None].
> They should either be interpreted as [''] and [None] or both as an
> empty list.
>
> Your proposed fix makes sense and I would take a patch.
Thank you Massimo!

the problem is that every time you don't insert any value in the field a
null string is validated (i.e. "").
As I can see from code[1] it seams to me the validator expects any kind
of value and if it's not a list/tuple it insert into a list and validate it.
Another problem is that[2] if the result of the operation
str(item).strip() is evaluated as False any validation is applied... so
there's no way to oblige the user not to pass a null value (i.e. to
insert any value).

Could it be ehough to remove the line 2520[2]? Why it has been introduced?

Cheers

    Manuele


[1] https://github.com/web2py/web2py/blob/master/gluon/validators.py#L2508
[2] https://github.com/web2py/web2py/blob/master/gluon/validators.py#L2520

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to