[Zope3-checkins] CVS: Zope3/src/zope/app/browser/component -
configure.zcml:1.10 interfacewidget.py:1.48
Garrett Smith
garrett at mojave-corp.com
Fri Mar 5 23:17:48 EST 2004
Update of /cvs-repository/Zope3/src/zope/app/browser/component
In directory cvs.zope.org:/tmp/cvs-serv15646/src/zope/app/browser/component
Modified Files:
configure.zcml interfacewidget.py
Log Message:
Merged changes from garrett-widgets2-branch:
- Changed the way widgets are looked up to use interfaces instead of
names.
- Refactor of zope/app/form/utility.py -- see
http://dev.zope.org/Zope3/WidgetsAndMultiwayAdapters
for details.
- Moved configuration of vocab widgets to its own zcml file
(zope/app/browser/form/vocabularywidget.zcml).
- Removed 'propertyNames' and 'getValue' from widgets. This is replaced
by accessing the widget attributes directly.
- Deleted depreated methods from widget interface: haveData and getData.
=== Zope3/src/zope/app/browser/component/configure.zcml 1.9 => 1.10 ===
--- Zope3/src/zope/app/browser/component/configure.zcml:1.9 Mon Aug 25 15:28:31 2003
+++ Zope3/src/zope/app/browser/component/configure.zcml Fri Mar 5 23:17:17 2004
@@ -1,29 +1,35 @@
-<zope:configure
- xmlns:zope="http://namespaces.zope.org/zope"
- xmlns="http://namespaces.zope.org/browser">
+<configure xmlns="http://namespaces.zope.org/zope">
- <page
- class=".interfacewidget.InterfaceWidget"
+ <view
+ type="zope.publisher.interfaces.browser.IBrowserRequest"
for="zope.app.interfaces.component.IInterfaceField"
- name="edit"
- permission="zope.Public" />
+ provides="zope.app.interfaces.form.IInputWidget"
+ factory=".interfacewidget.InterfaceWidget"
+ permission="zope.Public"
+ />
- <page
- class=".interfacewidget.InterfaceDisplayWidget"
+ <view
+ type="zope.publisher.interfaces.browser.IBrowserRequest"
for="zope.app.interfaces.component.IInterfaceField"
- name="display"
- permission="zope.Public" />
+ provides="zope.app.interfaces.form.IDisplayWidget"
+ factory=".interfacewidget.InterfaceDisplayWidget"
+ permission="zope.Public"
+ />
- <page
- class=".interfacewidget.MultiInterfaceWidget"
+ <view
+ type="zope.publisher.interfaces.browser.IBrowserRequest"
for="zope.app.interfaces.component.IInterfacesField"
- name="edit"
- permission="zope.Public" />
+ provides="zope.app.interfaces.form.IInputWidget"
+ factory=".interfacewidget.MultiInterfaceWidget"
+ permission="zope.Public"
+ />
- <page
- class=".interfacewidget.MultiInterfaceDisplayWidget"
+ <view
+ type="zope.publisher.interfaces.browser.IBrowserRequest"
for="zope.app.interfaces.component.IInterfacesField"
- name="display"
- permission="zope.Public" />
+ provides="zope.app.interfaces.form.IDisplayWidget"
+ factory=".interfacewidget.MultiInterfaceDisplayWidget"
+ permission="zope.Public"
+ />
-</zope:configure>
+</configure>
=== Zope3/src/zope/app/browser/component/interfacewidget.py 1.47 => 1.48 ===
--- Zope3/src/zope/app/browser/component/interfacewidget.py:1.47 Fri Mar 5 10:48:01 2004
+++ Zope3/src/zope/app/browser/component/interfacewidget.py Fri Mar 5 23:17:17 2004
@@ -18,10 +18,12 @@
from zope.interface import Interface, implements
from zope.app.browser.form.widget import BrowserWidget
from zope.app.i18n import ZopeMessageIDFactory as _
-from zope.app.browser.interfaces.form import IBrowserWidget
-from zope.app.interfaces.form \
- import WidgetInputError, ConversionError, MissingInputError
+from zope.app.interfaces.form import IInputWidget
+from zope.app.interfaces.form import WidgetInputError
+from zope.app.interfaces.form import ConversionError
+from zope.app.interfaces.form import MissingInputError
from zope.app.introspector import interfaceToName
+from zope.component import getService
from zope.component.exceptions import ComponentLookupError
from zope.publisher.browser import BrowserView
from xml.sax.saxutils import quoteattr
@@ -30,7 +32,7 @@
class InterfaceWidget(BrowserWidget, BrowserView):
- implements(IBrowserWidget)
+ implements(IInputWidget)
def _convert(self, value):
if value and value != 'None':
@@ -73,7 +75,7 @@
selected = field.default
else:
selected = marker
- if self._data is self._data_marker:
+ if not self._renderedValueSet():
value = self.request.form.get(self.name, marker) or marker
if value is not marker:
try:
@@ -104,7 +106,7 @@
# which is a tuple of interfaces.
class MultiInterfaceWidget(BrowserWidget, BrowserView):
- implements(IBrowserWidget)
+ implements(IInputWidget)
# Names used:
#
@@ -260,16 +262,6 @@
count += 1
return ''.join(elements)
- # --- deprecated methods of IBrowserWidget
-
- def renderHidden(self, value):
- 'See IBrowserWidget'
- raise NotImplementedError
-
- def render(self, value):
- 'See IBrowserWidget'
- raise NotImplementedError
-
class InterfaceDisplayWidget(InterfaceWidget):
def __call__(self):
@@ -282,6 +274,7 @@
else:
data = self._data
return interfaceToName(field.context, data)
+
class MultiInterfaceDisplayWidget(MultiInterfaceWidget):
def __call__(self):
@@ -292,6 +285,7 @@
data = self._data
return ', '.join([interfaceToName(field.context, interface)
for interface in data])
+
def renderInterfaceSelect(
interfaces, selected, search_name, search_string, select_name):
More information about the Zope3-Checkins
mailing list