[Zope3-Users] Difference between schema fields default and missing_value

Darryl Cousins darryl at darrylcousins.net.nz
Tue Jul 17 06:12:28 EDT 2007


On Tue, 2007-07-17 at 00:42 -0300, Luciano Ramalho wrote:
> I have not figured out the difference between these schema field attributes:
> - default: "The default value if none was provided."
> - missing_value: "In the case of missing input value, the value
> provided here is used."
> The quoted descriptions are from Philiipp's book (2nd ed), p. 61.
> How are they different, and what are the use cases for one and the other?

zope/schema/README.txt offers better descriptions::

- A value designated as ``missing``

  Missing values, when assigned to an object, indicate that there is 'no
  data' for that field. Missing values are analogous to null values in
  relational databases. For example, a boolean value can be True, False, or
  missing, in which case its value is unknown.

  While Python's None is the most likely value to signify 'missing', some
  fields may use different values. For example, it is common for text fields
  to use the empty string ('') to signify that a value is missing. Numeric
  fields may use 0 or -1 instead of None as their missing value.

  A field that is 'required' signifies that missing values are invalid and
  should not be assigned.

- A default value

  Default field values are assigned to objects when they are first created.

Hope this helps,

> Cheers,
> Luciano
> _______________________________________________
> Zope3-users mailing list
> Zope3-users at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users

More information about the Zope3-users mailing list