[Zope3-checkins] CVS: Zope3/src/zope/schema - interfaces.py:1.11
Fred L. Drake, Jr.
fred@zope.com
Thu, 24 Apr 2003 10:51:55 -0400
Update of /cvs-repository/Zope3/src/zope/schema
In directory cvs.zope.org:/tmp/cvs-serv30426
Modified Files:
interfaces.py
Log Message:
- make IDict and ISequence inherit from IContainer; this also affects
IList and ITuple
- revise a number of docstrings to better explain required behaviors
of the relevant field values
=== Zope3/src/zope/schema/interfaces.py 1.10 => 1.11 ===
--- Zope3/src/zope/schema/interfaces.py:1.10 Mon Apr 14 15:24:38 2003
+++ Zope3/src/zope/schema/interfaces.py Thu Apr 24 10:51:54 2003
@@ -184,19 +184,25 @@
class IIterable(IField):
u"""Fields with a value that can be iterated over.
- The value needs to follow the python __iter__ protocol.
+ The value needs to support iteration; the implementation mechanism
+ is not constrained. (Either __iter__() or __getitem__() may be
+ used.)
"""
class IContainer(IField):
u"""Fields whose value allows an 'x in value' check.
- The Value needs to have a conventional __contains__ method.
+ The Value needs to support the 'in' operator, but is not
+ constrained in how it does so (whether it defines __contains__()
+ or __getitem__() is immaterial).
"""
class IOrderable(IField):
u"""a Field requiring its value to be orderable.
- The value needs to have a conventional __cmp__ method.
+ The set of value needs support a complete ordering; the
+ implementation mechanism is not constrained. Either __cmp__() or
+ 'rich comparison' methods may be used.
"""
class ILen(IField):
@@ -208,7 +214,7 @@
class IMinMax(IOrderable):
u"""a Field requiring its value to be between min and max.
- This also means that the value needs to support the IOrderable interface.
+ This implies that the value needs to support the IOrderable interface.
"""
min = Field(
@@ -333,7 +339,7 @@
return False
return True
-class ISequence(IMinMaxLen, IIterable, IField):
+class ISequence(IMinMaxLen, IIterable, IContainer):
u"""a Field containing a Sequence value.
The Value must be iterable and may have a min_length/max_length.
@@ -356,11 +362,11 @@
class IList(ISequence):
u"""a Field containing a conventional list."""
-class IDict(IMinMaxLen, IIterable, IField):
+class IDict(IMinMaxLen, IIterable, IContainer):
u"""a Field containing a conventional dict.
- the key_types and value_types field allow specification
- of restrictions for the dict.
+ The key_types and value_types field allow specification
+ of restrictions for keys and values contained in the dict.
"""
key_types = Iterable(