[Zope3-checkins] CVS: Zope3/src/zope/schema - _bootstrapfields.py:1.12 _field.py:1.10 interfaces.py:1.10

Fred L. Drake, Jr. fred@zope.com
Mon, 14 Apr 2003 15:24:39 -0400


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

Modified Files:
	_bootstrapfields.py _field.py interfaces.py 
Log Message:
Make Enumerated, MinMaxLen, and Orderable true mixin classes.

=== Zope3/src/zope/schema/_bootstrapfields.py 1.11 => 1.12 ===
--- Zope3/src/zope/schema/_bootstrapfields.py:1.11	Mon Apr 14 14:21:36 2003
+++ Zope3/src/zope/schema/_bootstrapfields.py	Mon Apr 14 15:24:38 2003
@@ -162,10 +162,12 @@
             raise ValidationError(errornames.NotAnIterator, value)
 
 
-class Orderable(Field):
-    """Values of ordered fields can be sorted
+class Orderable:
+    """Values of ordered fields can be sorted.
 
     They can be restricted to a range of values.
+
+    Orderable is a mixin used in combination with Field.
     """
 
     min = ValidatedProperty('min')
@@ -199,7 +201,11 @@
             raise ValidationError(errornames.TooBig, value, self.max)
 
 _int_types = int, long
-class MinMaxLen(Field):
+class MinMaxLen:
+    """Expresses constraints on the length of a field.
+
+    MinMaxLen is a mixin used in combination with Field.
+    """
     min_length = 0
     max_length = None
 
@@ -218,7 +224,12 @@
             raise ValidationError(errornames.TooLong, value, self.max_length)
 
 
-class Enumerated(Field):
+class Enumerated:
+    """Enumerated fields can have a value found in a constant set of
+    values given by the field definition.
+
+    Enumerated is a mixin used in combination with Field.
+    """
 
     def __init__(self, allowed_values=None, default=None, **kw):
         # Set allowed_values to None so that we can validate if
@@ -260,7 +271,7 @@
                 raise ValidationError(errornames.InvalidValue, value,
                                       self.allowed_values)
 
-class Text(MinMaxLen, Enumerated, Field):
+class Text(Enumerated, MinMaxLen, Field):
     """A field containing text used for human discourse."""
     _type = unicode
 


=== Zope3/src/zope/schema/_field.py 1.9 => 1.10 ===
--- Zope3/src/zope/schema/_field.py:1.9	Mon Apr 14 14:21:36 2003
+++ Zope3/src/zope/schema/_field.py	Mon Apr 14 15:24:38 2003
@@ -63,7 +63,7 @@
     __implements__ = ISourceText
     _type = unicode
 
-class Bytes(MinMaxLen, Enumerated, Field):
+class Bytes(Enumerated, MinMaxLen, Field):
     __doc__ = IBytes.__doc__
     __implements__ = IBytes
 
@@ -141,7 +141,7 @@
     return errors
 
 
-class Sequence(MinMaxLen, Iterable):
+class Sequence(MinMaxLen, Iterable, Field):
     __doc__ = ISequence.__doc__
     __implements__ = ISequence
     value_types = FieldProperty(ISequence['value_types'])
@@ -169,7 +169,7 @@
     _type = list
 
 
-class Dict(MinMaxLen, Iterable):
+class Dict(MinMaxLen, Iterable, Field):
     """A field representing a Dict."""
     __implements__ = IDict
     _type = dict


=== Zope3/src/zope/schema/interfaces.py 1.9 => 1.10 ===
--- Zope3/src/zope/schema/interfaces.py:1.9	Mon Apr 14 14:21:36 2003
+++ Zope3/src/zope/schema/interfaces.py	Mon Apr 14 15:24:38 2003
@@ -264,7 +264,7 @@
 class IBool(IField):
     u"""a Boolean Field."""
 
-class IBytes(IMinMaxLen, IEnumerated, IIterable):
+class IBytes(IMinMaxLen, IEnumerated, IIterable, IField):
     # XXX IEnumerated will be removed in the future.
     u"""a Field containing a byte string (like the python str).
 
@@ -274,7 +274,7 @@
 class IBytesLine(IBytes):
     u"""a Field containing a byte string without newlines."""
 
-class IText(IMinMaxLen, IEnumerated, IIterable):
+class IText(IMinMaxLen, IEnumerated, IIterable, IField):
     # XXX IEnumerated doesn't make sense for multi-line strings, so will
     # be removed in the future.
     u"""a Field containing a unicode string."""
@@ -285,7 +285,7 @@
 class ITextLine(IText):
     u"""a Field containing a unicode string without newlines."""
 
-class IEnumeratedTextLine(ITextLine, IEnumerated):
+class IEnumeratedTextLine(IEnumerated, ITextLine):
     u"""a Field containing a unicode string without newlines.
 
     The value may be constrained to an element of a specified list.
@@ -294,7 +294,7 @@
 class IPassword(ITextLine):
     u"""a Field containing a unicode string without newlines that is a password."""
 
-class IInt(IMinMax, IEnumerated):
+class IInt(IMinMax, IEnumerated, IField):
     # XXX IEnumerated will be removed; use IEnumeratedInt instead if you
     # need the IEnumerated interface.
     u"""a Field containing an Integer Value."""
@@ -305,23 +305,23 @@
     The value may be constrained to an element of a specified list.
     """
 
-class IFloat(IMinMax, IEnumerated):
+class IFloat(IMinMax, IEnumerated, IField):
     # XXX IEnumerated will be removed; use IEnumeratedFloat instead if you
     # need the IEnumerated interface.
     u"""a Field containing a Float."""
 
-class IEnumeratedFloat(IFloat, IEnumerated):
+class IEnumeratedFloat(IEnumerated, IFloat):
     u"""a Field containing a Float.
 
     The value may be constrained to an element of a specified list.
     """
 
-class IDatetime(IMinMax, IEnumerated):
+class IDatetime(IMinMax, IEnumerated, IField):
     # XXX IEnumerated will be removed; use IEnumeratedDatetime instead
     # if you need the IEnumerated interface.
     u"""a Field containing a DateTime."""
 
-class IEnumeratedDatetime(IDatetime, IEnumerated):
+class IEnumeratedDatetime(IEnumerated, IDatetime):
     u"""a Field containing a DateTime.
 
     The value may be constrained to an element of a specified list.
@@ -333,7 +333,7 @@
             return False
     return True
 
-class ISequence(IMinMaxLen, IIterable):
+class ISequence(IMinMaxLen, IIterable, IField):
     u"""a Field containing a Sequence value.
 
     The Value must be iterable and may have a min_length/max_length.
@@ -356,7 +356,7 @@
 class IList(ISequence):
     u"""a Field containing a conventional list."""
 
-class IDict(IMinMaxLen, IIterable):
+class IDict(IMinMaxLen, IIterable, IField):
     u"""a Field containing a conventional dict.
 
     the key_types and value_types field allow specification