[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form - editview.py:1.7

R. David Murray bitz@bitdance.com
Mon, 27 Jan 2003 21:57:12 -0500


Update of /cvs-repository/Zope3/src/zope/app/browser/form
In directory cvs.zope.org:/tmp/cvs-serv8113/zope/app/browser/form

Modified Files:
	editview.py 
Log Message:
zope.app.form.utility had a function, fieldNames, that returned a
list of the Fields in a schema in schema order.  This is exactly
parallel to getFieldsInOrder from the schema package itself, and
it seems to me that's where it belongs.  So I added a getFieldNamesInOrder
function to schema.  I also added a getFieldNames in parallel to
getFields, to complete the set.  Everything that used fieldNames
is converted to use getFieldNamesInOrder.

The unit tests from form was actually a little stronger than those
in schema:  it made sure that all fields were returned when using
a derived schema, which the schema tests didn't.  So I added some
subschema tests to the schema test suite in addition to the tests
for the new functions themselves.



=== Zope3/src/zope/app/browser/form/editview.py 1.6 => 1.7 ===
--- Zope3/src/zope/app/browser/form/editview.py:1.6	Sun Jan 26 07:05:18 2003
+++ Zope3/src/zope/app/browser/form/editview.py	Mon Jan 27 21:56:40 2003
@@ -18,13 +18,13 @@
 from datetime import datetime
 
 from zope.schema.interfaces import ValidationError
+from zope.schema import getFieldNamesInOrder
 
 from zope.app.event import publish
 from zope.app.event.objectevent import ObjectModifiedEvent
 from zope.publisher.browser import BrowserView
 from zope.app.interfaces.form import WidgetsError
 from zope.app.form.utility import setUpEditWidgets, getWidgetsData
-from zope.app.form.utility import haveWidgetsData, fieldNames
 from zope.configuration.action import Action
 from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
 from zope.security.checker import defineChecker, NamesChecker
@@ -48,7 +48,7 @@
     label = ''
 
     # Fall-back field names computes from schema
-    fieldNames = property(lambda self: fieldNames(self.schema))
+    fieldNames = property(lambda self: getFieldNamesInOrder(self.schema))
 
     def __init__(self, context, request):
         super(EditView, self).__init__(context, request)
@@ -179,7 +179,7 @@
 
     template = str(template)
 
-    names = fieldNames(schema)
+    names = getFieldNamesInOrder(schema)
 
     if fields:
         fields = fields.split()