[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form - add.py:1.37.10.1 addwizard.py:1.12.12.1 configure.zcml:1.25.4.3

Garrett Smith garrett at mojave-corp.com
Sun Feb 8 23:32:14 EST 2004


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

Modified Files:
      Tag: ozzope-widgets-branch
	add.py addwizard.py configure.zcml 
Log Message:

Continued refactoring of widgets. Now using view types to lookup widgets
when constructing forms instead of magic names. Next steps include
integration tests for registered widgets, fix existing tests, update
documentation, and fix vocab widgets.


=== Zope3/src/zope/app/browser/form/add.py 1.37 => 1.37.10.1 ===
--- Zope3/src/zope/app/browser/form/add.py:1.37	Tue Dec 16 15:33:36 2003
+++ Zope3/src/zope/app/browser/form/add.py	Sun Feb  8 23:31:43 2004
@@ -24,6 +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 WidgetsError
 from zope.app.pagetemplate.simpleviewclass import SimpleViewClass
 from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
@@ -43,7 +44,7 @@
     """
 
     def _setUpWidgets(self):
-        setUpWidgets(self, self.schema, names=self.fieldNames)
+        setUpWidgets(self, self.schema, IEditWidget, names=self.fieldNames)
 
     def update(self):
 


=== Zope3/src/zope/app/browser/form/addwizard.py 1.12 => 1.12.12.1 ===
--- Zope3/src/zope/app/browser/form/addwizard.py:1.12	Fri Nov 21 12:10:10 2003
+++ Zope3/src/zope/app/browser/form/addwizard.py	Sun Feb  8 23:31:43 2004
@@ -22,6 +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.pagetemplate.simpleviewclass import SimpleViewClass
 from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
 from zope.component import getAdapter
@@ -44,7 +45,7 @@
         else:
             self.storage = WizardStorage(self.fieldNames, None)
 
-        setUpWidgets(self, self.schema, names=self.fieldNames)
+        setUpWidgets(self, self.schema, IEditWidget, names=self.fieldNames)
 
     def create(self, *args, **kw):
         """Do the actual instantiation."""


=== Zope3/src/zope/app/browser/form/configure.zcml 1.25.4.2 => 1.25.4.3 ===
--- Zope3/src/zope/app/browser/form/configure.zcml:1.25.4.2	Sun Feb  8 21:17:15 2004
+++ Zope3/src/zope/app/browser/form/configure.zcml	Sun Feb  8 23:31:43 2004
@@ -1,16 +1,19 @@
 <configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:browser="http://namespaces.zope.org/browser">
+   
+  <!-- Core display widgets -->
 
-  <!-- Form Widget View Directives -->
-  <browser:defaultView for="zope.schema.interfaces.IField" name="edit" />
-
-  <!-- XXX The next directive should be replaced by one that 
-       uses a 'smart' widget that knows how to deal with type-agnostic
-       values, which is the porpose of zope.schema.Field -->
-
-  <!-- XXX OZ this type of widget doesn't make sense - remove registration -->
+  <view
+      type="zope.publisher.interfaces.browser.IBrowserRequest"     
+      for="zope.schema.interfaces.IField"
+      provides="zope.app.interfaces.form.IDisplayWidget"
+      factory="zope.app.browser.form.widget.DisplayWidget"      
+      permission="zope.Public"
+      />
       
+  <!-- Core edit widgets -->
+   
   <view
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.ITextLine"
@@ -137,7 +140,7 @@
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IEnumeratedTextLine"
       provides="zope.app.interfaces.form.IEditWidget"
-      factory="zope.app.browser.form.widget.EnumeratedTextWidget"
+      factory=".enumerated.EnumeratedTextWidget"
       permission="zope.Public"
       />
 
@@ -145,7 +148,7 @@
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IEnumeratedInt"
       provides="zope.app.interfaces.form.IEditWidget"
-      factory="zope.app.browser.form.widget.EnumeratedIntWidget"
+      factory=".enumerated.EnumeratedIntWidget"
       permission="zope.Public"
       />
 
@@ -153,7 +156,7 @@
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IEnumeratedFloat"
       provides="zope.app.interfaces.form.IEditWidget"
-      factory="zope.app.browser.form.widget.EnumeratedFloatWidget"
+      factory=".enumerated.EnumeratedFloatWidget"
       permission="zope.Public"
       />
 
@@ -161,7 +164,7 @@
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IEnumeratedDatetime"
       provides="zope.app.interfaces.form.IEditWidget"
-      factory="zope.app.browser.form.widget.EnumeratedDatetimeWidget"
+      factory=".enumerated.EnumeratedDatetimeWidget"
       permission="zope.Public"
       />
 
@@ -169,9 +172,10 @@
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IEnumeratedDate"
       provides="zope.app.interfaces.form.IEditWidget"
-      factory="zope.app.browser.form.widget.EnumeratedDateWidget"
+      factory=".enumerated.EnumeratedDateWidget"
       permission="zope.Public"
       />
+      
   <!-- Vocabulary fields share special widget factories that redirect
        to the vocabularies they reference. -->
 
@@ -180,8 +184,8 @@
   <view
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IVocabularyField"
-      provides="zope.app.interfaces.form.IEditWidget"
-      factory="zope.app.browser.form.widget.VocabularyFieldDisplayWidget"
+      provides="zope.app.interfaces.form.IDisplayWidget"
+      factory=".vocabularywidget.VocabularyFieldDisplayWidget"
       permission="zope.Public"
       />
 
@@ -189,23 +193,25 @@
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IVocabularyField"
       provides="zope.app.interfaces.form.IEditWidget"
-      factory="zope.app.browser.form.widget.VocabularyFieldEditWidget"
+      factory=".vocabularywidget.VocabularyFieldEditWidget"
       permission="zope.Public"
       />
+
   <!-- Bags -->
 
   <view
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IVocabularyBagField"
-      provides="zope.app.interfaces.form.IEditWidget"
-      factory="zope.app.browser.form.widget.VocabularyBagFieldDisplayWidget"
+      provides="zope.app.interfaces.form.IDisplayWidget"
+      factory=".vocabularywidget.VocabularyBagFieldDisplayWidget"
       permission="zope.Public"
       />
+      
   <view
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IVocabularyBagField"
       provides="zope.app.interfaces.form.IEditWidget"
-      factory="zope.app.browser.form.widget.VocabularyBagFieldEditWidget"
+      factory=".vocabularywidget.VocabularyBagFieldEditWidget"
       permission="zope.Public"
       />
 
@@ -214,15 +220,16 @@
   <view
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IVocabularyListField"
-      provides="zope.app.interfaces.form.IEditWidget"
-      factory="zope.app.browser.form.widget.VocabularyListFieldDisplayWidget"
+      provides="zope.app.interfaces.form.IDisplayWidget"
+      factory=".vocabularywidget.VocabularyListFieldDisplayWidget"
       permission="zope.Public"
       />
+
   <view
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IVocabularyListField"
       provides="zope.app.interfaces.form.IEditWidget"
-      factory="zope.app.browser.form.widget.VocabularyListFieldEditWidget"
+      factory=".vocabularywidget.VocabularyListFieldEditWidget"
       permission="zope.Public"
       />
 
@@ -231,15 +238,15 @@
   <view
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IVocabularySetField"
-      provides="zope.app.interfaces.form.IEditWidget"
-      factory="zope.app.browser.form.widget.VocabularySetFieldDisplayWidget"
+      provides="zope.app.interfaces.form.IDisplayWidget"
+      factory=".vocabularywidget.VocabularySetFieldDisplayWidget"
       permission="zope.Public"
       />
   <view
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IVocabularySetField"
       provides="zope.app.interfaces.form.IEditWidget"
-      factory="zope.app.browser.form.widget.VocabularySetFieldEditWidget"
+      factory=".vocabularywidget.VocabularySetFieldEditWidget"
       permission="zope.Public"
       />
 
@@ -248,126 +255,17 @@
   <view
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IVocabularyUniqueListField"
-      provides="zope.app.interfaces.form.IEditWidget"
-      factory=
-      "zope.app.browser.form.widget.VocabularyUniqueListFieldDisplayWidget"
+      provides="zope.app.interfaces.form.IDisplayWidget"
+      factory=".vocabularywidget.VocabularyUniqueListFieldDisplayWidget"
       permission="zope.Public"
       />
+      
   <view
       type="zope.publisher.interfaces.browser.IBrowserRequest"
       for="zope.schema.interfaces.IVocabularyUniqueListField"
       provides="zope.app.interfaces.form.IEditWidget"
-      factory=
-      "zope.app.browser.form.widget.VocabularyUniqueListFieldEditWidget"
-      permission="zope.Public"
-      />
-
-  <!-- Query view helpers -->
-
-  <view
-      type="zope.publisher.interfaces.browser.IBrowserRequest"
-      for="zope.schema.interfaces.IIterableVocabularyQuery"
-      provides="zope.app.interfaces.form.IEditWidget"
-      factory="zope.app.browser.form.widget.IterableVocabularyQueryViewWidget"
-      permission="zope.Public"
-      />
-  <view
-      type="zope.publisher.interfaces.browser.IBrowserRequest"
-      for="zope.schema.interfaces.IVocabularyQueryField"
-      provides="zope.app.interfaces.form.IEditWidget"
-      factory="zope.app.browser.form.widget.VocabularyQueryFieldWidget"
-      permission="zope.Public"
-      />
-
-  <view
-      type="zope.publisher.interfaces.browser.IBrowserRequest"
-      for="zope.schema.interfaces.IIterableVocabularyQueryField"
-      provides="zope.app.interfaces.form.IEditWidget"
-      factory=
-      "zope.app.browser.form.widget.IterableVocabularyQueryMultiViewWidget"
-      permission="zope.Public"
-      />
-  <!-- Vocabulary field display widgets -->
-  
-  <view
-      type="zope.publisher.interfaces.browser.IBrowserRequest"
-      for="zope.schema.interfaces.IVocabularyDisplayWidget"
-      provides="zope.app.interfaces.form.IEditWidget"
-      factory="zope.app.browser.form.widget.VocabularyWidget"
-      permission="zope.Public"
-      />
-
-  <view
-      permission="zope.Public"
-      type="zope.publisher.interfaces.browser.IBrowserRequest"
-      factory=".vocabularywidget.VocabularyBagDisplayWidget"
-      name="field-display-bag-widget"
-      for="zope.schema.interfaces.IVocabulary"
-      />
-
-  <view
-      type="zope.publisher.interfaces.browser.IBrowserRequest"
-      for="zope.schema.interfaces.IVocabularyDisplayWidget"
-      provides="zope.app.interfaces.form.IEditWidget"
-      factory="zope.app.browser.form.widget.VocabularyWidget"
-      permission="zope.Public"
-      />
-
-  <view
-      permission="zope.Public"
-      type="zope.publisher.interfaces.browser.IBrowserRequest"
-      factory=".vocabularywidget.VocabularyListDisplayWidget"
-      name="field-display-list-widget"
-      for="zope.schema.interfaces.IVocabulary"
-      />
-
-  <view
-      type="zope.publisher.interfaces.browser.IBrowserRequest"
-      for="zope.schema.interfaces.IVocabularyDisplayWidget"
-      provides="zope.app.interfaces.form.IEditWidget"
-      factory="zope.app.browser.form.widget.VocabularyWidget"
-      permission="zope.Public"
-      />
-  <view
-      permission="zope.Public"
-      type="zope.publisher.interfaces.browser.IBrowserRequest"
-      factory=".vocabularywidget.VocabularyBagDisplayWidget"
-      name="field-display-set-widget"
-      for="zope.schema.interfaces.IVocabulary"
-      />
-
-  <view
-      permission="zope.Public"
-      type="zope.publisher.interfaces.browser.IBrowserRequest"
-      factory=".vocabularywidget.VocabularyListDisplayWidget"
-      name="field-display-unique-list-widget"
-      for="zope.schema.interfaces.IVocabulary"
-      />
-
-  <!-- Vocabulary edit widgets -->
-  <view
+      factory=".vocabularywidget.VocabularyUniqueListFieldEditWidget"
       permission="zope.Public"
-      type="zope.publisher.interfaces.browser.IBrowserRequest"
-      factory=".vocabularywidget.VocabularyEditWidget"
-      name="field-edit-widget"
-      for="zope.schema.interfaces.IVocabulary"
-      />
-
-  <view
-      permission="zope.Public"
-      type="zope.publisher.interfaces.browser.IBrowserRequest"
-      factory=".vocabularywidget.VocabularyMultiEditWidget"
-      name="field-edit-list-widget"
-      for="zope.schema.interfaces.IVocabulary"
-      />
-
-  <!-- Default simple display view -->
-  <browser:page
-      permission="zope.Public"
-      allowed_interface="zope.app.interfaces.browser.form.IBrowserWidget"
-      for="zope.schema.interfaces.IField"
-      name="display"
-      class="zope.app.browser.form.widget.DisplayWidget"
       />
 
 </configure>




More information about the Zope3-Checkins mailing list