[Zope3-checkins] CVS: Zope3/src/zope/schema - _bootstrapfields.py:1.21

Garrett Smith garrett at mojave-corp.com
Wed Aug 13 18:19:34 EDT 2003


Update of /cvs-repository/Zope3/src/zope/schema
In directory cvs.zope.org:/tmp/cvs-serv7942/src/zope/schema

Modified Files:
	_bootstrapfields.py 
Log Message:
Added missing_value to Field initializer keywords.

=== Zope3/src/zope/schema/_bootstrapfields.py 1.20 => 1.21 ===
--- Zope3/src/zope/schema/_bootstrapfields.py:1.20	Mon Jul 28 18:22:21 2003
+++ Zope3/src/zope/schema/_bootstrapfields.py	Wed Aug 13 17:19:30 2003
@@ -44,9 +44,9 @@
     _type = None
     context = None
 
-    # if input for this Field is missing, and that's ok, then this is the
-    # value to use
+    # If a field has no assigned value, it will be set to missing_value.
     missing_value = None
+    _missing_value_marker = object()
 
     # Note that the "order" field has a dual existance:
     # 1. The class variable Field.order is used as a source for the
@@ -62,7 +62,7 @@
     def __init__(self, __name__='', __doc__='',
                  title=u'', description=u'',
                  required=True, readonly=False, constraint=None, default=None,
-                 ):
+                 missing_value=_missing_value_marker):
         """Pass in field values as keyword parameters.
 
 
@@ -132,6 +132,9 @@
         # Keep track of the order of field definitions
         Field.order += 1
         self.order = Field.order
+
+        if missing_value is not self._missing_value_marker:
+            self.missing_value = missing_value
 
     def bind(self, object):
         clone = self.__class__.__new__(self.__class__)




More information about the Zope3-Checkins mailing list