[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form - add.py:1.38.2.2 addwizard.py:1.12.22.2 configure.zcml:1.25.14.3 editview.py:1.47.4.2 editwizard.py:1.20.4.2 schemadisplay.py:1.14.4.2 widget.py:1.64.14.2

Garrett Smith garrett at mojave-corp.com
Mon Mar 1 18:33:37 EST 2004


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

Modified Files:
      Tag: garrett-widgets2-branch
	add.py addwizard.py configure.zcml editview.py editwizard.py 
	schemadisplay.py widget.py 
Log Message:
Changes related to widget machinery:

- Added source argument to setUpEditWidgets and setUpDisplayWidgets.
- Renamed IEditWidget to IInputWidget.
- Added a widgetsData attribute to zope.app.interfaces.formWidgetsError.



=== Zope3/src/zope/app/browser/form/add.py 1.38.2.1 => 1.38.2.2 ===
--- Zope3/src/zope/app/browser/form/add.py:1.38.2.1	Thu Feb 26 00:10:49 2004
+++ Zope3/src/zope/app/browser/form/add.py	Mon Mar  1 18:33:06 2004
@@ -24,7 +24,7 @@
 from zope.app.event.objectevent import ObjectCreatedEvent
 from zope.app.form.utility import setUpWidgets, getWidgetsData
 from zope.app.i18n import ZopeMessageIDFactory as _
-from zope.app.interfaces.form import IEditWidget
+from zope.app.interfaces.form import IInputWidget
 from zope.app.interfaces.form import WidgetsError
 from zope.app.pagetemplate.simpleviewclass import SimpleViewClass
 from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
@@ -43,7 +43,7 @@
     """
 
     def _setUpWidgets(self):
-        setUpWidgets(self, self.schema, IEditWidget, names=self.fieldNames)
+        setUpWidgets(self, self.schema, IInputWidget, names=self.fieldNames)
 
     def update(self):
 


=== Zope3/src/zope/app/browser/form/addwizard.py 1.12.22.1 => 1.12.22.2 ===
--- Zope3/src/zope/app/browser/form/addwizard.py:1.12.22.1	Thu Feb 26 00:10:49 2004
+++ Zope3/src/zope/app/browser/form/addwizard.py	Mon Mar  1 18:33:06 2004
@@ -22,7 +22,7 @@
 from zope.app.event.objectevent import ObjectCreatedEvent
 from zope.app.form.utility import setUpWidgets
 from zope.app.interfaces.form import WidgetsError
-from zope.app.interfaces.form import IEditWidget
+from zope.app.interfaces.form import IInputWidget
 from zope.app.pagetemplate.simpleviewclass import SimpleViewClass
 from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
 from zope.component import getAdapter
@@ -45,7 +45,7 @@
         else:
             self.storage = WizardStorage(self.fieldNames, None)
 
-        setUpWidgets(self, self.schema, IEditWidget, names=self.fieldNames)
+        setUpWidgets(self, self.schema, IInputWidget, names=self.fieldNames)
 
     def create(self, *args, **kw):
         """Do the actual instantiation."""


=== Zope3/src/zope/app/browser/form/configure.zcml 1.25.14.2 => 1.25.14.3 ===
--- Zope3/src/zope/app/browser/form/configure.zcml:1.25.14.2	Mon Mar  1 11:46:23 2004
+++ Zope3/src/zope/app/browser/form/configure.zcml	Mon Mar  1 18:33:06 2004
@@ -14,98 +14,98 @@
   <view
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.ITextLine"
-      provides="zope.app.interfaces.form.IEditWidget"
+      provides="zope.app.interfaces.form.IInputWidget"
       factory="zope.app.browser.form.widget.TextWidget"
       />
 
   <view
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IText"
-      provides="zope.app.interfaces.form.IEditWidget"
+      provides="zope.app.interfaces.form.IInputWidget"
       factory="zope.app.browser.form.widget.TextAreaWidget"
       />
 
   <view
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.ISourceText"
-      provides="zope.app.interfaces.form.IEditWidget"
+      provides="zope.app.interfaces.form.IInputWidget"
       factory="zope.app.browser.form.widget.TextAreaWidget"
       />
 
   <view
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IBytesLine"
-      provides="zope.app.interfaces.form.IEditWidget"
+      provides="zope.app.interfaces.form.IInputWidget"
       factory="zope.app.browser.form.widget.BytesWidget"
       />
 
   <view
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IBytes"
-      provides="zope.app.interfaces.form.IEditWidget"
+      provides="zope.app.interfaces.form.IInputWidget"
       factory="zope.app.browser.form.widget.FileWidget"
       />
 
   <view
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IASCII"
-      provides="zope.app.interfaces.form.IEditWidget"
+      provides="zope.app.interfaces.form.IInputWidget"
       factory="zope.app.browser.form.widget.BytesAreaWidget"
       />
 
   <view
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IInt"
-      provides="zope.app.interfaces.form.IEditWidget"
+      provides="zope.app.interfaces.form.IInputWidget"
       factory="zope.app.browser.form.widget.IntWidget"
       />
 
   <view
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IFloat"
-      provides="zope.app.interfaces.form.IEditWidget"
+      provides="zope.app.interfaces.form.IInputWidget"
       factory="zope.app.browser.form.widget.FloatWidget"
       />
 
   <view
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IDatetime"
-      provides="zope.app.interfaces.form.IEditWidget"
+      provides="zope.app.interfaces.form.IInputWidget"
       factory="zope.app.browser.form.widget.DatetimeWidget"
       />
 
   <view
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IDate"
-      provides="zope.app.interfaces.form.IEditWidget"
+      provides="zope.app.interfaces.form.IInputWidget"
       factory="zope.app.browser.form.widget.DateWidget"
       />
 
   <view
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IBool"
-      provides="zope.app.interfaces.form.IEditWidget"
+      provides="zope.app.interfaces.form.IInputWidget"
       factory="zope.app.browser.form.widget.CheckBoxWidget"
       />
 
   <view
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.ITuple"
-      provides="zope.app.interfaces.form.IEditWidget"
+      provides="zope.app.interfaces.form.IInputWidget"
       factory="zope.app.browser.form.widget.TupleSequenceWidget"
       />
 
   <view
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IList"
-      provides="zope.app.interfaces.form.IEditWidget"
+      provides="zope.app.interfaces.form.IInputWidget"
       factory="zope.app.browser.form.widget.ListSequenceWidget"
       />
 
   <view
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IPassword"
-      provides="zope.app.interfaces.form.IEditWidget"
+      provides="zope.app.interfaces.form.IInputWidget"
       factory="zope.app.browser.form.widget.PasswordWidget"
       />
 
@@ -114,35 +114,35 @@
   <view
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IEnumeratedTextLine"
-      provides="zope.app.interfaces.form.IEditWidget"
+      provides="zope.app.interfaces.form.IInputWidget"
       factory=".enumerated.EnumeratedTextWidget"
       />
 
   <view
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IEnumeratedInt"
-      provides="zope.app.interfaces.form.IEditWidget"
+      provides="zope.app.interfaces.form.IInputWidget"
       factory=".enumerated.EnumeratedIntWidget"
       />
 
   <view
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IEnumeratedFloat"
-      provides="zope.app.interfaces.form.IEditWidget"
+      provides="zope.app.interfaces.form.IInputWidget"
       factory=".enumerated.EnumeratedFloatWidget"
       />
 
   <view
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IEnumeratedDatetime"
-      provides="zope.app.interfaces.form.IEditWidget"
+      provides="zope.app.interfaces.form.IInputWidget"
       factory=".enumerated.EnumeratedDatetimeWidget"
       />
 
   <view
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IEnumeratedDate"
-      provides="zope.app.interfaces.form.IEditWidget"
+      provides="zope.app.interfaces.form.IInputWidget"
       factory=".enumerated.EnumeratedDateWidget"
       />
       
@@ -161,7 +161,7 @@
   <view
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IVocabularyField"
-      provides="zope.app.interfaces.form.IEditWidget"
+      provides="zope.app.interfaces.form.IInputWidget"
       factory=".vocabularywidget.VocabularyFieldEditWidget"
       />
 
@@ -177,7 +177,7 @@
   <view
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IVocabularyBagField"
-      provides="zope.app.interfaces.form.IEditWidget"
+      provides="zope.app.interfaces.form.IInputWidget"
       factory=".vocabularywidget.VocabularyBagFieldEditWidget"
       />
 
@@ -193,7 +193,7 @@
   <view
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IVocabularyListField"
-      provides="zope.app.interfaces.form.IEditWidget"
+      provides="zope.app.interfaces.form.IInputWidget"
       factory=".vocabularywidget.VocabularyListFieldEditWidget"
       />
 
@@ -209,7 +209,7 @@
   <view
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IVocabularySetField"
-      provides="zope.app.interfaces.form.IEditWidget"
+      provides="zope.app.interfaces.form.IInputWidget"
       factory=".vocabularywidget.VocabularySetFieldEditWidget"
       />
 
@@ -225,7 +225,7 @@
   <view
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IVocabularyUniqueListField"
-      provides="zope.app.interfaces.form.IEditWidget"
+      provides="zope.app.interfaces.form.IInputWidget"
       factory=".vocabularywidget.VocabularyUniqueListFieldEditWidget"
       />
 	  


=== Zope3/src/zope/app/browser/form/editview.py 1.47.4.1 => 1.47.4.2 ===
--- Zope3/src/zope/app/browser/form/editview.py:1.47.4.1	Thu Feb 26 00:10:49 2004
+++ Zope3/src/zope/app/browser/form/editview.py	Mon Mar  1 18:33:06 2004
@@ -64,8 +64,8 @@
                 adapted = LocationProxy(adapted)
             adapted.__parent__ = self.context
         self.adapted = adapted
-        setUpEditWidgets(self, self.schema, names=self.fieldNames,
-                         context=self.adapted)
+        setUpEditWidgets(self, self.schema, source=self.adapted, 
+                         names=self.fieldNames)
 
     def setPrefix(self, prefix):
         for widget in self.widgets():
@@ -94,7 +94,7 @@
             changed = False
             try:
                 changed = applyWidgetsChanges(self, self.schema,
-                    names=self.fieldNames, context=content)
+                    target=content, names=self.fieldNames)
                 # We should not generate events when an adapter is used.
                 # That's the adapter's job.
                 if changed and self.context is self.adapted:
@@ -103,8 +103,9 @@
                 self.errors = errors
                 status = _("An error occured.")
             else:
-                setUpEditWidgets(self, self.schema, ignoreStickyValues=True,
-                                 names=self.fieldNames, context=self.adapted)
+                setUpEditWidgets(self, self.schema, source=self.adapted,
+                                 ignoreStickyValues=True, 
+                                 names=self.fieldNames)
                 if changed:
                     self.changed()
                     formatter = self.request.locale.dates.getFormatter(


=== Zope3/src/zope/app/browser/form/editwizard.py 1.20.4.1 => 1.20.4.2 ===
--- Zope3/src/zope/app/browser/form/editwizard.py:1.20.4.1	Thu Feb 26 00:10:49 2004
+++ Zope3/src/zope/app/browser/form/editwizard.py	Mon Mar  1 18:33:06 2004
@@ -72,8 +72,8 @@
             self.storage = WizardStorage(self.fieldNames, adapted)
 
         # Add all our widgets as attributes on this view
-        setUpEditWidgets(self, self.schema, names=self.fieldNames,
-                         context=self.storage)
+        setUpEditWidgets(self, self.schema, source=self.storage,
+                         names=self.fieldNames)
 
     def widgets(self):
         return [getattr(self, name+'_widget')
@@ -172,8 +172,8 @@
         for k,v in storage.items():
             getattr(self,k).setRenderedValue(v)
         content = self.adapted
-        changed = applyWidgetsChanges(self, self.schema,
-                names=self.fieldNames, context=content)
+        changed = applyWidgetsChanges(self, self.schema, target=content,
+                names=self.fieldNames)
         # We should not generate events when an adapter is used.
         # That's the adapter's job
         if changed and self.context is self.adapted:


=== Zope3/src/zope/app/browser/form/schemadisplay.py 1.14.4.1 => 1.14.4.2 ===
--- Zope3/src/zope/app/browser/form/schemadisplay.py:1.14.4.1	Thu Feb 26 00:10:49 2004
+++ Zope3/src/zope/app/browser/form/schemadisplay.py	Mon Mar  1 18:33:06 2004
@@ -53,8 +53,8 @@
                 adapted = LocationProxy(adapted)
             adapted.__parent__ = self.context
         self.adapted = adapted
-        setUpDisplayWidgets(self, self.schema, names=self.fieldNames,
-                            context=adapted)
+        setUpDisplayWidgets(self, self.schema, source=adapted,
+                            names=self.fieldNames)
 
     def setPrefix(self, prefix):
         for widget in self.widgets():


=== Zope3/src/zope/app/browser/form/widget.py 1.64.14.1 => 1.64.14.2 ===
--- Zope3/src/zope/app/browser/form/widget.py:1.64.14.1	Thu Feb 26 00:10:49 2004
+++ Zope3/src/zope/app/browser/form/widget.py	Mon Mar  1 18:33:07 2004
@@ -31,7 +31,7 @@
 
 from zope.app import zapi
 from zope.app.tests import ztapi
-from zope.app.interfaces.form import IEditWidget
+from zope.app.interfaces.form import IInputWidget
 from zope.app.interfaces.browser.form import IBrowserWidget
 from zope.app.form.widget import Widget
 from zope.app.form.utility import setUpEditWidgets, applyWidgetsChanges
@@ -52,8 +52,6 @@
     errors are rendered with the view machinery, so we need to set up
     a lot of machinery to support translation and views:
         
-    XXX OZ - move the more complex testing into a test module
-
     >>> setUp() # now we have to set up an error view...
     >>> from zope.app.interfaces.form import IWidgetInputError
     >>> from zope.app.publisher.browser import BrowserView
@@ -332,7 +330,7 @@
     tests/test_checkboxwidget.py.
     """
     
-    implements(IEditWidget)
+    implements(IInputWidget)
     
     inputType = 'checkbox'
     default = 0
@@ -430,7 +428,7 @@
 
     """
     
-    implements(IEditWidget)
+    implements(IInputWidget)
 
     default = ''
     displayWidth = 20
@@ -524,7 +522,7 @@
 
 class FloatWidget(TextWidget):
     
-    implements(IEditWidget)
+    implements(IInputWidget)
     displayWidth = 10
 
     def _convert(self, value):
@@ -619,7 +617,7 @@
 
     """
 
-    implements(IEditWidget)
+    implements(IInputWidget)
 
     default = ""
     width = 60
@@ -764,7 +762,7 @@
     """A widget that has a number of items in it."""
     # What the heck is this for?
     
-    implements(IEditWidget)
+    implements(IInputWidget)
     
 
 class SingleItemsWidget(ItemsWidget):
@@ -1011,7 +1009,7 @@
                  items in the sequence
     """
 
-    implements(IEditWidget)
+    implements(IInputWidget)
 
     _type = tuple    
     _data = () # pre-existing sequence items (from setRenderedValue)
@@ -1083,7 +1081,7 @@
         if self.subwidget:
             widget = self.subwidget(field, self.request)
         else:
-            widget = zapi.getViewProviding(field, IEditWidget, self.request,
+            widget = zapi.getViewProviding(field, IInputWidget, self.request,
                                            context=self.context)
         widget.setPrefix('%s.%d.'%(self.name, i))
         return widget
@@ -1224,21 +1222,9 @@
                  represents
     *_widget   - Optional CustomWidgets used to generate widgets for the
                  fields in this widget
-                 
-    XXX This widget will not work with the default widget lookup scheme
-    because its initializer requires an additional 'factory' argument.
-    We should consider enhancing IObject to provide a factory function
-    to create an instance of the IObject schema. This would replace this
-    widget's factory facility. E.g.
-    
-        class IFoo:
-            bar = Object(schema=IBar, factory=Bar)
-            
-    This would be enough information for the object widget to render bar
-    fields (bound) and create default values for bar.
     """
 
-    implements(IEditWidget)
+    implements(IInputWidget)
     
     _object = None      # the object value (from setRenderedValue & request)
     _request_parsed = False
@@ -1265,8 +1251,8 @@
 
     def _setUpEditWidgets(self):
         # subwidgets need a new name
-        setUpEditWidgets(self, self.context.schema, prefix=self.name, 
-                         names=self.names, context=self.context)
+        setUpEditWidgets(self, self.context.schema, source=self.context,
+                         prefix=self.name, names=self.names)
 
     def __call__(self):
         """Render the widget
@@ -1322,8 +1308,8 @@
 
         # apply sub changes, see if there *are* any changes
         # XXX ObjectModifiedEvent here would be nice
-        changes = applyWidgetsChanges(self, field.schema,
-            names=self.names, context=value)
+        changes = applyWidgetsChanges(self, field.schema, target=value,
+                                      names=self.names)
 
         # if there's changes, then store the new value on the content
         if changes:




More information about the Zope3-Checkins mailing list