[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form - configure.zcml:1.6.6.2 widget.py:1.29.4.9
Fred L. Drake, Jr.
fred@zope.com
Tue, 13 May 2003 11:05:10 -0400
Update of /cvs-repository/Zope3/src/zope/app/browser/form
In directory cvs.zope.org:/tmp/cvs-serv8652
Modified Files:
Tag: schema-vocabulary-branch
configure.zcml widget.py
Log Message:
- use zope:view instead of browser:page to configure the vocabulary
widgets from ZCML; this avoids unnecessary dynamic subclassing
- widget.py: revert changes from 1.29.4.7, .8 (making the vocabulary
field widgets dummy classes instead of functions), now that the
excess machinery has been avoided
=== Zope3/src/zope/app/browser/form/configure.zcml 1.6.6.1 => 1.6.6.2 ===
--- Zope3/src/zope/app/browser/form/configure.zcml:1.6.6.1 Fri May 2 12:27:07 2003
+++ Zope3/src/zope/app/browser/form/configure.zcml Tue May 13 11:05:09 2003
@@ -104,36 +104,40 @@
<!-- Vocabulary fields share special widget factories that redirect
to the vocabularies they reference. -->
- <browser:page
+ <view
permission="zope.Public"
+ type="zope.publisher.interfaces.browser.IBrowserPresentation"
allowed_interface="zope.app.interfaces.browser.form.IBrowserWidget"
for="zope.schema.vocabulary.IVocabularyField"
name="display"
- class="zope.app.browser.form.widget.VocabularyFieldDisplayWidget"
+ factory="zope.app.browser.form.widget.VocabularyFieldDisplayWidget"
/>
- <browser:page
+ <view
permission="zope.Public"
+ type="zope.publisher.interfaces.browser.IBrowserPresentation"
allowed_interface="zope.app.interfaces.browser.form.IBrowserWidget"
for="zope.schema.vocabulary.IVocabularyField"
name="edit"
- class="zope.app.browser.form.widget.VocabularyFieldEditWidget"
+ factory="zope.app.browser.form.widget.VocabularyFieldEditWidget"
/>
- <browser:page
+ <view
permission="zope.Public"
+ type="zope.publisher.interfaces.browser.IBrowserPresentation"
allowed_interface="zope.app.interfaces.browser.form.IBrowserWidget"
for="zope.schema.vocabulary.IVocabularyMultiField"
name="display"
- class="zope.app.browser.form.widget.VocabularyMultiFieldDisplayWidget"
+ factory="zope.app.browser.form.widget.VocabularyMultiFieldDisplayWidget"
/>
- <browser:page
+ <view
permission="zope.Public"
+ type="zope.publisher.interfaces.browser.IBrowserPresentation"
allowed_interface="zope.app.interfaces.browser.form.IBrowserWidget"
for="zope.schema.vocabulary.IVocabularyMultiField"
name="edit"
- class="zope.app.browser.form.widget.VocabularyMultiFieldEditWidget"
+ factory="zope.app.browser.form.widget.VocabularyMultiFieldEditWidget"
/>
<!-- Default simple display view -->
=== Zope3/src/zope/app/browser/form/widget.py 1.29.4.8 => 1.29.4.9 ===
--- Zope3/src/zope/app/browser/form/widget.py:1.29.4.8 Mon May 12 13:19:44 2003
+++ Zope3/src/zope/app/browser/form/widget.py Tue May 13 11:05:09 2003
@@ -696,38 +696,30 @@
# These widget factories delegate to the vocabulary on the field.
-# These are required to be classes by the painful implementation of the
-# browser:page ZCML directive; we use __new__() so we can do the right
-# thing without having to act as a proxy or otherwise dispatch to the
-# implementation class.
-class VocabularyFieldDisplayWidget:
- def __new__(cls, field, request):
- """Return a display widget based on a vocabulary field."""
- view = getView(field.vocabulary, "field-display-widget", request)
- view.setField(field)
- return view
+def VocabularyFieldDisplayWidget(field, request):
+ """Return a display widget based on a vocabulary field."""
+ view = getView(field.vocabulary, "field-display-widget", request)
+ view.setField(field)
+ return view
-class VocabularyFieldEditWidget:
- def __new__(cls, field, request):
- """Return a value-selection widget based on a vocabulary field."""
- view = getView(field.vocabulary, "field-edit-widget", request)
- view.setField(field)
- return view
+def VocabularyFieldEditWidget(field, request):
+ """Return a value-selection widget based on a vocabulary field."""
+ view = getView(field.vocabulary, "field-edit-widget", request)
+ view.setField(field)
+ return view
-class VocabularyMultiFieldDisplayWidget:
- def __new__(cls, field, request):
- """Return a display widget based on a vocabulary field."""
- view = getView(field.vocabulary, "field-display-multi-widget", request)
- view.setField(field)
- return view
+def VocabularyMultiFieldDisplayWidget(field, request):
+ """Return a display widget based on a vocabulary field."""
+ view = getView(field.vocabulary, "field-display-multi-widget", request)
+ view.setField(field)
+ return view
-class VocabularyMultiFieldEditWidget:
- def __new__(cls, field, request):
- """Return a value-selection widget based on a vocabulary field."""
- view = getView(field.vocabulary, "field-edit-multi-widget", request)
- view.setField(field)
- return view
+def VocabularyMultiFieldEditWidget(field, request):
+ """Return a value-selection widget based on a vocabulary field."""
+ view = getView(field.vocabulary, "field-edit-multi-widget", request)
+ view.setField(field)
+ return view
class VocabularyWidgetBase(BrowserWidget):