[Zope3-checkins] CVS: Zope3/src/zope/app/browser/services -
adapter.py:1.13 field.py:1.13 view.py:1.23
Garrett Smith
garrett at mojave-corp.com
Wed Aug 13 18:28:48 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app/browser/services
In directory cvs.zope.org:/tmp/cvs-serv9151/src/zope/app/browser/services
Modified Files:
adapter.py field.py view.py
Log Message:
Made the following changes to the widget machinery:
- Renamed IWidget getData to getInputValue
getInputValue no longer accepts an 'optional' flag. If value is missing or is invalid, getInputValue will raise an error. Calls made to this method should be in a try...except block to handle such conditions.
- Renamed IWidget haveData to hasInput
- Added method hasValidInput to IWidget and widget implementations
- Renamed IWidget setData to setRenderedValue
- Added functional tests for some of the core widgets - additional ftests are needed
- Deleted the class PossibleEmptyMeansMissing - it's no longer needed
- Added deprecation tests for changes to widgets
- Some widgets were refactored to use the new framework correctly
These changes were based on the proposal:
http://dev.zope.org/Zope3/ComponentArchitecture/WidgetsFormsSchemas
Not all the changes in the proposal are included in this commit. Specifically, getRawData/setRawData and the refactoring of the widget error classes are the two major changes not included in this commit.
=== Zope3/src/zope/app/browser/services/adapter.py 1.12 => 1.13 ===
--- Zope3/src/zope/app/browser/services/adapter.py:1.12 Thu Aug 7 13:41:03 2003
+++ Zope3/src/zope/app/browser/services/adapter.py Wed Aug 13 17:28:14 2003
@@ -62,8 +62,10 @@
setUpWidgets(self, IAdapterSearch)
def configInfo(self):
- forInterface = self.forInterface_widget.getData()
- providedInterface = self.providedInterface_widget.getData()
+ forInterface = self.forInterface.hasInput() and \
+ self.forInterface.getInputValue() or None
+ providedInterface = self.providedInterface.hasInput() and \
+ self.providedInterface.getInputValue() or None
result = []
=== Zope3/src/zope/app/browser/services/field.py 1.12 => 1.13 ===
--- Zope3/src/zope/app/browser/services/field.py:1.12 Thu Aug 7 13:41:03 2003
+++ Zope3/src/zope/app/browser/services/field.py Wed Aug 13 17:28:14 2003
@@ -26,13 +26,6 @@
class ComponentPathWidget(BrowserWidget):
- def haveData(self):
- value = self.request.form.get(self.name, None)
- if not value:
- return False
- else:
- return super(ComponentPathWidget, self).haveData()
-
def _convert(self, value):
return value or None
=== Zope3/src/zope/app/browser/services/view.py 1.22 => 1.23 ===
--- Zope3/src/zope/app/browser/services/view.py:1.22 Thu Aug 7 13:41:03 2003
+++ Zope3/src/zope/app/browser/services/view.py Wed Aug 13 17:28:14 2003
@@ -184,10 +184,15 @@
def configInfo(self):
"""Do a search, or (by default) return all view pages."""
- input_for = self.forInterface_widget.getData()
- input_type = self.presentationType_widget.getData()
- input_name = self.viewName_widget.getData()
- input_layer = self.layer_widget.getData()
+
+ input_for = self.forInterface.hasInput() and \
+ self.forInterface.getInputValue() or None
+ input_type = self.presentationType.hasInput() and \
+ self.presentationType.getInputValue() or None
+ input_name = self.viewName.hasInput() and \
+ self.viewName.getInputValue() or None
+ input_layer = self.layer.hasInput() and \
+ self.layer.getInputValue() or None
result = []
for info in self.context.getRegisteredMatching(
More information about the Zope3-Checkins
mailing list