[Zope3-checkins] CVS: Zope3/src/zope/schema - _bootstrapfields.py:1.8
Fred L. Drake, Jr.
fred@zope.com
Wed, 9 Apr 2003 11:51:57 -0400
Update of /cvs-repository/Zope3/src/zope/schema
In directory cvs.zope.org:/tmp/cvs-serv22447
Modified Files:
_bootstrapfields.py
Log Message:
- add comment explaining the dual nature of the "order" attribute
- normalize whitespace
=== Zope3/src/zope/schema/_bootstrapfields.py 1.7 => 1.8 ===
--- Zope3/src/zope/schema/_bootstrapfields.py:1.7 Tue Mar 25 06:47:56 2003
+++ Zope3/src/zope/schema/_bootstrapfields.py Wed Apr 9 11:51:56 2003
@@ -25,8 +25,8 @@
class ValidatedProperty:
- def __init__(self, name, check = None):
- self.__info = name, check
+ def __init__(self, name, check=None):
+ self.__info = name, check
def __set__(self, inst, value):
name, check = self.__info
@@ -41,9 +41,16 @@
# Type restrictions, if any
_type = None
- order = 0
context = None
+ # Note that the "order" field has a dual existance:
+ # 1. The class variable Field.order is used as a source for the
+ # monotonically increasing values used to provide...
+ # 2. The instance variable self.order which provides a
+ # monotonically increasing value that tracks the creation order
+ # of Field (including Field subclass) instances.
+ order = 0
+
constraint = None
default = ValidatedProperty('default')
@@ -53,11 +60,10 @@
):
"""Pass in field values as keyword parameters."""
-
if not __doc__:
if title:
if description:
- __doc__ = "%s\n\n%s" % (title, description)
+ __doc__ = "%s\n\n%s" % (title, description)
else:
__doc__ = title
elif description:
@@ -72,7 +78,7 @@
self.constraint = constraint
self.default = default
- # Keep track of the order of field definition
+ # Keep track of the order of field definitions
Field.order += 1
self.order = Field.order
@@ -259,7 +265,7 @@
class Password(TextLine):
"""A text field containing a text used as a password."""
-
+
class Bool(Field):
"""A field representing a Bool."""
_type = type(True)