[Zope3-dev] zope.schema Field... constraints: should they really constrain each other?

Stephan Richter srichter at cosmos.phy.tufts.edu
Sun Feb 5 12:03:25 EST 2006


On Thursday 19 January 2006 04:05, Shaun Cutts wrote:
> What is happening is that "min" (and max) are ValidatedProperties of
> Orderable. When a "missing_value" is supplied, min = None (by default)
> is checked and fails validation.

Good analysis.

> One solution is to change "None" into missing_value in the Orderable
> __init__. More exhaustively, min, max, and default should have defaults
> as "__missing_value_marker" in the Orderable __init__ (using the trick
> in Field.__init__), which would then be converted to the actual
> missing_value, if specified, or None, if not.

Yes, this sounds like the right way to do it.

> (But I don't know if constraints should (always?) apply to each other.
> For instance, if "min" were actually defined as the largest value
> smaller than the range, it wouldn't validate against itself.)

There should definitely be a check there; you are right.

It would be great, if you could check in your suggestions into the repository 
or at least make an issue entry!

Good work!

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training


More information about the Zope3-dev mailing list