[Zope3-dev] default and required analysis
Steve Alexander
steve@cat-box.net
Fri, 10 Jan 2003 09:26:51 +0000
Jim Fulton wrote:
>
> Based on Martijn's analysis and Steve's comments, I proposed the following:
>
> - If a field is in the schema, objects that implement the schema must
> have a corresponding property implementing the field.
That's a very strong statement. I don't disagree with it. It just feels
like it is stronger that it needs to be.
> - If a field is required, then all values of properties implementing the
> field must satisfy the field's constraints.
>
> - If a field is not required, then a property implementing a field may
> have a field-defined missing value that does not satisfy the field's
> constraints.
> The default missing value will be None, but fields may provide
> different missing values.
Can I clarify this as "A field may provide a missing value" ?
That is, there is only one 'missing' value per field, and this is None
by default.
> - Fields may define default values. An application (like a form) can use
> this default value to provide a value when a value is needed and no other
> value is available. The default value may be the field-defined missing
> value or a value that satisfies the field's constraints.
>
> If a field is required and the default value does not satisfy the field's
> constraints, then the default value cannot be used to provide a value
> for a property implementing the field.
I am +1 on the whole proposal.
--
Steve Alexander