From: Ksenia M. <kse...@gm...> - 2005-09-08 21:07:23
|
2005/9/8, Ian Bicking <ia...@co...>: > Ksenia Marasanova wrote: > > 2005/9/8, Ian Bicking <ia...@co...>: > > > >>Ksenia Marasanova wrote: > >> > >>>Hi, > >>> > >>>When "max" parameter is specified for String validator that is allowed > >>>to be empty, error occures when None value is passed: > >>> > >>>........ line 842, in validate_python > >>> if self.max is not None and len(value) > self.max: > >>>TypeError: len() of unsized object > >>> > >>>Is it a bug or am I doing something wrong? > >> > >>Sounds like a bug, should be fixed in r975. Should also work with min > >>now as well. > > > > > > Thanks for the quick response. > > But it looks like "min" now implies "not_empty". Is it intentional? >=20 > Well, that's kind of an outstanding issue; right now not_empty is > implied in many places. But not everywhere. This just exposes that, I > guess; it wasn't really changed. >=20 > To me min>0 does kind of imply not_empty, though I suppose it could be > argument that None should still get through if not_empty had to be given > explicitly. Except None and '' are generally treated very similarly, > and min>0 *definitely* implies that '' isn't valid. I think I am in the camp of "None is not '' " :). Maybe it can be made an option, something like "keep_blank_values" in cgi.FieldStorage... --=20 Ksenia |