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?
>=20
> 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?
>>> validators.String(max=3D2).to_python(None)
>>> validators.String(min=3D2).to_python(None)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/Users/ksenia/www/3rdparty/formencode/api.py", line 223, in to_pyth=
on
self.validate_python)
File "/Users/ksenia/www/3rdparty/formencode/api.py", line 211, in
attempt_convert
post(converted, state)
File "validators.py", line 851, in validate_python
value, state)
api.Invalid: Enter a value 2 characters long or more
>>>=20
--=20
Ksenia
|