[Zope3-checkins] CVS: Zope3/src/zope/app/browser/services - adapter.py:1.5

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


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

Modified Files:
	adapter.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/services/adapter.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/browser/services/adapter.py:1.4	Mon Jan 27 20:59:09 2003
+++ Zope3/src/zope/app/browser/services/adapter.py	Mon Jan 27 21:56:41 2003
@@ -28,6 +28,7 @@
 import md5
 
 from zope.interface import Interface
+from zope.schema import getFieldNamesInOrder
 from zope.component import getView
 from zope.publisher.browser import BrowserView
 from zope.proxy.context import ContextWrapper
@@ -36,7 +37,7 @@
 from zope.app.interfaces.services.interfaces import IAdapterConfigurationInfo
 from zope.app.interfaces.services.configuration import IConfiguration
 from zope.app.form.utility import setUpWidgets, getWidgetsData
-from zope.app.form.utility import getWidgetsDataForContent, fieldNames
+from zope.app.form.utility import getWidgetsDataForContent
 from zope.app.event import publish
 from zope.app.event.objectevent import ObjectCreatedEvent
 from zope.app.services.adapter import AdapterConfiguration
@@ -107,8 +108,8 @@
 
     def getWidgets(self):
         return ([getattr(self, name)
-                 for name in fieldNames(IAdapterConfigurationInfo)]
+                 for name in getFieldNamesInOrder(IAdapterConfigurationInfo)]
                 +
                 [getattr(self, name)
-                 for name in fieldNames(IConfiguration)]
+                 for name in getFieldNamesInOrder(IConfiguration)]
                 )