[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form - vocabularywidget.py:1.38

Fred L. Drake, Jr. fred@zope.com
Mon, 9 Jun 2003 15:31:58 -0400


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

Modified Files:
	vocabularywidget.py 
Log Message:
- IterableVocabularyQuery.__init__():  Allow additional interfaces to
  be passed to the constructor, to allow alternate views to be
  registered for use in different applications.
- IterableVocabularyQueryView.renderQueryResults():  Use super() where
  applicable.


=== Zope3/src/zope/app/browser/form/vocabularywidget.py 1.37 => 1.38 ===
--- Zope3/src/zope/app/browser/form/vocabularywidget.py:1.37	Mon Jun  9 14:25:40 2003
+++ Zope3/src/zope/app/browser/form/vocabularywidget.py	Mon Jun  9 15:31:57 2003
@@ -27,6 +27,7 @@
 from zope.app.i18n import ZopeMessageIDFactory as _
 from zope.app.interfaces.browser.form import IVocabularyQueryView
 from zope.app.interfaces.form import WidgetInputError, MissingInputError
+from zope.interface.declarations import directlyProvides
 from zope.publisher.browser import BrowserView
 from zope.component import getView
 from zope.schema.interfaces import IIterableVocabulary, IVocabularyQuery
@@ -106,8 +107,10 @@
 
     implements(IIterableVocabularyQuery)
 
-    def __init__(self, vocabulary):
+    def __init__(self, vocabulary, *interfaces):
         self.vocabulary = vocabulary
+        if interfaces:
+            directlyProvides(self, *interfaces)
 
 
 class TranslationHook:
@@ -741,11 +744,10 @@
         return self.mkselectionlist("radio", items, name)
 
     def renderQueryResults(self, results, value):
-        return IterableVocabularyQueryViewBase.renderQueryResults(
-            self, results, [value])
+        return super(IterableVocabularyQueryView, self).renderQueryResults(
+            results, [value])
 
 class IterableVocabularyQueryMultiView(IterableVocabularyQueryViewBase):
 
     def makeSelectionList(self, items, name):
         return self.mkselectionlist("checkbox", items, name)
-