[Zope3-checkins] CVS: Zope3/src/zope/app/browser/workflow/stateful - contentworkflow.py:1.6 definition.py:1.6

Garrett Smith garrett at mojave-corp.com
Wed Aug 13 18:29:03 EDT 2003


Update of /cvs-repository/Zope3/src/zope/app/browser/workflow/stateful
In directory cvs.zope.org:/tmp/cvs-serv9151/src/zope/app/browser/workflow/stateful

Modified Files:
	contentworkflow.py definition.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/workflow/stateful/contentworkflow.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/browser/workflow/stateful/contentworkflow.py:1.5	Mon Aug 11 12:56:49 2003
+++ Zope3/src/zope/app/browser/workflow/stateful/contentworkflow.py	Wed Aug 13 17:28:28 2003
@@ -80,8 +80,8 @@
     def update(self):
         status = ''
         if 'ADD' in self.request:
-            for name in self.name_widget.getData():
-                self.context.register(self.iface_widget.getData(), name)
+            for name in self.name_widget.getInputValue():
+                self.context.register(self.iface_widget.getInputValue(), name)
             status = _('Mapping(s) added.')
         elif 'REMOVE' in self.request:
             mappings = self.request.get('mappings', [])


=== Zope3/src/zope/app/browser/workflow/stateful/definition.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/browser/workflow/stateful/definition.py:1.5	Thu Jul 31 11:01:27 2003
+++ Zope3/src/zope/app/browser/workflow/stateful/definition.py	Wed Aug 13 17:28:28 2003
@@ -102,8 +102,10 @@
             schema = self.context.relevantDataSchema
             perms = trustedRemoveSecurityProxy(self.context.schemaPermissions)
             for name, field in getFields(schema).items():
-                getPerm = getattr(self, name+'_get_perm_widget').getData()
-                setPerm = getattr(self, name+'_set_perm_widget').getData()
+                getPerm = getattr(
+                    self, name+'_get_perm_widget').getInputValue()
+                setPerm = getattr(
+                    self, name+'_set_perm_widget').getInputValue()
                 perms[name] = (getPerm, setPerm)
             status = 'Fields permissions mapping updated.'
 




More information about the Zope3-Checkins mailing list