[Zope3-checkins] CVS: Zope3/src/zope/schema - _schema.py:1.5

R. David Murray bitz@bitdance.com
Mon, 27 Jan 2003 20:03:54 -0500


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

Modified Files:
	_schema.py 
Log Message:
Use iter and getitem syntax instead of explicit method calls.  I *think*
this is the prefered coding in places where the former have been blessed.
I myself certainly find the code a lot easier to understand in this form
than when it said 'getDescriptionFor'.  If I'm wrong, I'll back it out <grin>.


=== Zope3/src/zope/schema/_schema.py 1.4 => 1.5 ===
--- Zope3/src/zope/schema/_schema.py:1.4	Sat Jan 25 00:13:48 2003
+++ Zope3/src/zope/schema/_schema.py	Mon Jan 27 20:03:51 2003
@@ -18,12 +18,12 @@
 from zope.schema.interfaces import ValidationError
 
 def getFields(schema):
-    """Get all fields on a schema.
+    """Return a dictionary containing all the Fields in a schema.
     """
     from zope.schema.interfaces import IField
     fields = {}
-    for name in schema.names(all=True):
-        attr = schema.getDescriptionFor(name)
+    for name in schema:
+        attr = schema[name]
         if IField.isImplementedBy(attr):
             fields[name] = attr
     return fields