[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form/tests - test_vocabularywidget.py:1.15

Fred L. Drake, Jr. fred@zope.com
Tue, 3 Jun 2003 15:26:49 -0400


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

Modified Files:
	test_vocabularywidget.py 
Log Message:
- use new-style implements()
- update to use views for concrete vocabulary multi-selection fields;
  avoid using the abstract flavor directly


=== Zope3/src/zope/app/browser/form/tests/test_vocabularywidget.py 1.14 => 1.15 ===
--- Zope3/src/zope/app/browser/form/tests/test_vocabularywidget.py:1.14	Tue Jun  3 10:16:11 2003
+++ Zope3/src/zope/app/browser/form/tests/test_vocabularywidget.py	Tue Jun  3 15:26:48 2003
@@ -22,11 +22,13 @@
 from zope.app.tests.placelesssetup import PlacelessSetup
 from zope.component import getView
 from zope.component.view import provideView
+from zope.interface.declarations import implements
 from zope.publisher.browser import TestRequest
 from zope.publisher.interfaces.browser import IBrowserPresentation
 
 from zope.schema.interfaces import IVocabulary, ITerm, IVocabularyQuery
 from zope.schema.interfaces import IVocabularyField, IVocabularyMultiField
+from zope.schema.interfaces import IVocabularyListField
 from zope.schema.interfaces import IIterableVocabularyQuery
 from zope.schema.interfaces import IVocabularyTokenized, ITokenizedTerm
 from zope.schema import vocabulary
@@ -37,7 +39,7 @@
 
 class SampleTerm(object):
     """Trivial ITerm implementation."""
-    __implements__ = ITokenizedTerm
+    implements(ITokenizedTerm)
 
     def __init__(self, value):
         self.value = value
@@ -46,7 +48,7 @@
 
 class BasicVocabulary(object):
     """Simple vocabulary that uses terms from a passed-in list of values."""
-    __implements__ = IVocabularyTokenized, IVocabulary
+    implements(IVocabularyTokenized, IVocabulary)
 
     def __init__(self, values):
         self._values = values
@@ -88,7 +90,7 @@
 
 class SampleVocabulary(BasicVocabulary):
     """Vocabulary used to test vocabulary-based specialization of widgets."""
-    __implements__ = ISampleVocabulary
+    implements(ISampleVocabulary)
 
 
 class SampleDisplayWidget(vocabularywidget.VocabularyWidgetBase):
@@ -96,7 +98,7 @@
 
     This is not intended to be a useful widget.
     """
-    __implements__ = IBrowserWidget
+    implements(IBrowserWidget)
 
     def __call__(self):
         return "foo"
@@ -120,7 +122,7 @@
 class MyVocabularyQuery:
     """Vocabulary query object which query views can be registered for."""
 
-    __implements__ = IMyVocabularyQuery
+    implements(IMyVocabularyQuery)
 
     def __init__(self, vocabulary):
         self.vocabulary = vocabulary
@@ -142,7 +144,7 @@
 class MyQueryViewSingle(MyQueryViewBase):
     """Single-selection vocabulary query view."""
 
-    __implements__ = IVocabularyQueryView
+    implements(IVocabularyQueryView)
 
     def getLabel(self):
         return "single"
@@ -151,7 +153,7 @@
 class MyQueryViewMulti(MyQueryViewBase):
     """Multi-selection vocabulary query view."""
 
-    __implements__ = IVocabularyQueryView
+    implements(IVocabularyQueryView)
 
     def getLabel(self):
         return "multi"
@@ -258,21 +260,21 @@
                     "display",
                     IBrowserPresentation,
                     vocabularywidget.VocabularyMultiFieldDisplayWidget)
-        provideView(IVocabularyMultiField,
+        provideView(IVocabularyListField,
                     "edit",
                     IBrowserPresentation,
-                    vocabularywidget.VocabularyMultiFieldEditWidget)
+                    vocabularywidget.VocabularyListFieldEditWidget)
         # Bind widgets to the vocabulary fields:
         provideView(IVocabularyTokenized,
                     "field-display-multi-widget",
                     IBrowserPresentation,
                     vocabularywidget.VocabularyMultiDisplayWidget)
         provideView(IVocabularyTokenized,
-                    "field-edit-multi-widget",
+                    "field-edit-list-widget",
                     IBrowserPresentation,
                     vocabularywidget.VocabularyMultiEditWidget)
         provideView(IIterableVocabularyQuery,
-                    "widget-query-multi-helper",
+                    "widget-query-list-helper",
                     IBrowserPresentation,
                     vocabularywidget.IterableVocabularyQueryMultiView)
         # The following widget registration supports the specific
@@ -549,7 +551,7 @@
     def registerViews(self):
         MultiSelectionViews.registerViews(self)
         provideView(IMyVocabularyQuery,
-                    "widget-query-multi-helper",
+                    "widget-query-list-helper",
                     IBrowserPresentation,
                     MyQueryViewMulti)