[FE-discuss] Int and OneOf

Top Page
Author: Andreas Klostermann
Date:  
To: formencode-discuss
Subject: [FE-discuss] Int and OneOf
Hello there,

I tried using formencode for PyGTK applications, and a few things puzzle
me. In the docs on formencode.org the Int validator seems to take "min"
and "max" values. I tried to create a validator like Int(min=0, max=10)
and expected it to complain about -1, for example. It doesn't. It
doesn't even complain about the arguments at instantiation. I don't
really know where to find the "real" docs, since those on the page seem
to be about 0.4, and the source code published there, too. In this
revision of the formencode package, min and max are actually used.
In the python files installed on my machine (formencod 0.7) the min and
max values are not used, which seems odd.

Probably this functionality was stripped for a reason. But then, how is
the new recommended way of validating a range of integers?

Another quirk is with OneOf. OneOf complains about a value that is not
in it's reference list. That works. It doesn't complain about an empty
string or a "None" value, which aren't in the list, and I expected
to_python() to throw an exception about that.

Probably there is a way to do that too.

Thanks,
Andreas


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
FormEncode-discuss mailing list
FormEncode-discuss@???
https://lists.sourceforge.net/lists/listinfo/formencode-discuss