[Zope3-checkins] CVS: Zope3/src/zope/schema -
_bootstrapfields.py:1.22
Fred L. Drake, Jr.
fred at zope.com
Thu Aug 14 11:36:19 EDT 2003
Update of /cvs-repository/Zope3/src/zope/schema
In directory cvs.zope.org:/tmp/cvs-serv12167
Modified Files:
_bootstrapfields.py
Log Message:
- explain the use of a marker for the missing_value argument to the
Field constructor
- make the marker more private
=== Zope3/src/zope/schema/_bootstrapfields.py 1.21 => 1.22 ===
--- Zope3/src/zope/schema/_bootstrapfields.py:1.21 Wed Aug 13 17:19:30 2003
+++ Zope3/src/zope/schema/_bootstrapfields.py Thu Aug 14 10:36:14 2003
@@ -46,7 +46,12 @@
# If a field has no assigned value, it will be set to missing_value.
missing_value = None
- _missing_value_marker = object()
+
+ # This is the default value for the missing_value argument to the
+ # Field constructor. A marker is helpful since we don't want to
+ # overwrite missing_value if it is set differently on a Field
+ # subclass and isn't specified via the constructor.
+ __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 +67,7 @@
def __init__(self, __name__='', __doc__='',
title=u'', description=u'',
required=True, readonly=False, constraint=None, default=None,
- missing_value=_missing_value_marker):
+ missing_value=__missing_value_marker):
"""Pass in field values as keyword parameters.
@@ -133,7 +138,7 @@
Field.order += 1
self.order = Field.order
- if missing_value is not self._missing_value_marker:
+ if missing_value is not self.__missing_value_marker:
self.missing_value = missing_value
def bind(self, object):
More information about the Zope3-Checkins
mailing list