[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/ Fixed issue 449 by removing the wizard code. It was broken, not maintained

Stephan Richter srichter at cosmos.phy.tufts.edu
Wed Nov 16 15:15:23 EST 2005


Log message for revision 40174:
  Fixed issue 449 by removing the wizard code. It was broken, not maintained 
  and clearly not properly tested.
  

Changed:
  U   Zope3/trunk/src/zope/app/apidoc/zcmlmodule/README.txt
  D   Zope3/trunk/src/zope/app/form/browser/addwizard.pt
  D   Zope3/trunk/src/zope/app/form/browser/addwizard.py
  D   Zope3/trunk/src/zope/app/form/browser/editwizard.pt
  D   Zope3/trunk/src/zope/app/form/browser/editwizard.py
  U   Zope3/trunk/src/zope/app/form/browser/meta.zcml
  U   Zope3/trunk/src/zope/app/form/browser/metaconfigure.py
  U   Zope3/trunk/src/zope/app/form/browser/metadirectives.py
  D   Zope3/trunk/src/zope/app/form/browser/tests/test_editwizardview.py

-=-
Modified: Zope3/trunk/src/zope/app/apidoc/zcmlmodule/README.txt
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/zcmlmodule/README.txt	2005-11-16 20:12:12 UTC (rev 40173)
+++ Zope3/trunk/src/zope/app/apidoc/zcmlmodule/README.txt	2005-11-16 20:15:22 UTC (rev 40174)
@@ -83,11 +83,10 @@
   >>> ns.get('foo') is None
   True
 
-  >>> print '\n'.join([name for name, dir in ns.items()][:4])
+  >>> print '\n'.join([name for name, dir in ns.items()][:3])
   addMenuItem
   addform
   addview
-  addwizard
 
 
 `quoteNS(ns)`

Deleted: Zope3/trunk/src/zope/app/form/browser/addwizard.pt
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/addwizard.pt	2005-11-16 20:12:12 UTC (rev 40173)
+++ Zope3/trunk/src/zope/app/form/browser/addwizard.pt	2005-11-16 20:15:22 UTC (rev 40174)
@@ -1,87 +0,0 @@
-<tal:block condition="view/update"/>
-<html metal:use-macro="context/@@standard_macros/page"
-    i18n:domain="zope">
-
-  <body>
-    <div metal:fill-slot="body">
-
-      <div metal:define-macro="body">
-
-        <form action="." tal:attributes="action request/URL" method="post"
-              enctype="multipart/form-data">
-
-          <div metal:define-macro="formbody">
-
-            <h3 tal:condition="view/label"
-                tal:content="view/label"
-                metal:define-slot="heading"
-                >Edit something</h3>
-
-                <p tal:condition="view/feedback" tal:content="view/feedback">
-                  A feedback message to the user
-                </p>
-
-                <div tal:condition="view/errors">
-                  <ul>
-                    <li tal:repeat="error view/errors">
-                      <strong tal:content="error/__class__">
-                        Error Type</strong>:
-                        <span tal:content="error">Error text</span>
-                    </li>
-                  </ul>
-                </div>
-
-                <div metal:define-slot="extra_info" tal:replace="nothing">
-                </div>
-
-                <div class="row" metal:define-slot="extra_top"
-                     tal:replace="nothing">
-                  <div class="label">Extra top</div>
-                  <div class="label">
-                    <input type="text" style="width:100%" />
-                  </div>
-                </div>
-
-                <div metal:use-macro="context/@@form_macros/widget_rows" />
-
-                <div class="row"
-                     metal:define-slot="extra_bottom"
-                     tal:replace="nothing">
-                  <div class="label">Extra bottom</div>
-                  <div class="field">
-                    <input type="text" style="width:100%" />
-                  </div>
-                </div>
-
-          </div>
-
-          <div class="row">
-            <div class="controls">
-              <!--
-                <input type="submit" value="Refresh"
-                       i18n:attributes="value refresh-button"
-                       />
-              -->
-              <input tal:condition="view/show_previous"
-                     type="submit" name="PREVIOUS_SUBMIT" value="Previous"
-                     i18n:attributes="value previous-button" />
-              <input tal:condition="view/show_submit"
-                     type="submit" name="UPDATE_SUBMIT" value="Submit"
-                     i18n:attributes="value submit-button"/>
-              <input tal:condition="view/show_next"
-                     type="submit" name="NEXT_SUBMIT" value="Next"
-                     i18n:attributes="value next-button" />
-            </div>
-          </div>
-          <div class="separator"></div>
-
-          <div tal:replace="structure view/renderHidden">
-            <!-- type=hidden input controls for passing state without session -->
-            <input type="hidden" name="example" value="foo" />
-          </div>
-        </form>
-      </div>
-    </div>
-  </body>
-
-</html>

Deleted: Zope3/trunk/src/zope/app/form/browser/addwizard.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/addwizard.py	2005-11-16 20:12:12 UTC (rev 40173)
+++ Zope3/trunk/src/zope/app/form/browser/addwizard.py	2005-11-16 20:15:22 UTC (rev 40174)
@@ -1,161 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Add Wizard View Classes
-
-$Id$
-"""
-__docformat__ = 'restructuredtext'
-
-import sys
-
-from zope.app import zapi
-from zope.component.interfaces import IFactory
-from zope.event import notify
-from zope.interface import Interface
-
-from zope.app.event.objectevent import ObjectCreatedEvent
-from zope.app.form.utility import setUpWidgets
-from zope.app.form.interfaces import WidgetsError, IInputWidget
-from zope.app.pagetemplate.simpleviewclass import SimpleViewClass
-from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
-from zope.publisher.interfaces.browser import IDefaultBrowserLayer
-from zope.schema.interfaces import ValidationError
-from zope.security.checker import defineChecker, NamesChecker
-from editwizard import EditWizardView, WizardStorage
-
-class AddWizardView(EditWizardView):
-    """Multi-page add-view base class.
-
-    Subclasses should provide a `schema` attribute defining the schema
-    to be edited.
-    """
-
-    def _setUpWidgets(self):
-        if self.use_session:
-            # Need session for File upload fields
-            raise NotImplementedError('Need a working ISessionDataManager')
-        else:
-            self.storage = WizardStorage(self.fieldNames, None)
-
-        setUpWidgets(self, self.schema, IInputWidget, names=self.fieldNames)
-
-    def create(self, *args, **kw):
-        """Do the actual instantiation."""
-        return self._factory(*args, **kw)
-
-    def apply_update(self, data):
-        """Add the desired object using the data in the data argument.
-
-        The data argument is a dictionary with the data entered in the form.
-
-        Issues a redirect to `context.nextURL()`
-
-        Returns ``False``, as per `editview.apply_update`
-        """
-
-        # This code originally from add.py's createAndAdd method
-
-        args = []
-        for name in self._arguments:
-            args.append(data[name])
-
-        kw = {}
-        for name in self._keyword_arguments:
-            if name in data:
-                kw[str(name)] = data[name]
-
-        content = self.create(*args, **kw)
-        adapted = self.schema(content)
-
-        errors = []
-
-        for name in self._set_before_add:
-            if name in data:
-                field = self.schema[name]
-                try:
-                    field.set(adapted, data[name])
-                except ValidationError:
-                    errors.append(sys.exc_info()[1])
-
-        if errors:
-            raise WidgetsError(*errors)
-
-        notify(ObjectCreatedEvent(content))
-
-        content = self.context.add(content)
-
-        adapted = self.schema(content)
-
-        for name in self._set_after_add:
-            if name in data:
-                field = self.schema[name]
-                try:
-                    field.set(adapted, data[name])
-                except ValidationError:
-                    errors.append(sys.exc_info()[1])
-
-        if errors:
-            raise WidgetsError(*errors)
-
-        self.request.response.redirect(self.context.nextURL())
-        return False
-
-
-# helper for factory resp. content_factory handling
-def _getFactory(self):
-    # get factory or factory id
-    factory = self.__dict__.get('_factory_or_id', self._factory_or_id)
-
-    if type(factory) is str: # factory id
-        return zapi.getUtility(IFactory, factory, self.context)
-    else:
-        return factory
-
-def _setFactory(self, value):
-    self.__dict__['_factory_or_id'] = value
-
-
-# TODO: Needs unittest
-def AddWizardViewFactory(
-    name, schema, permission, layer, panes, fields,
-    template, default_template, bases, for_, content_factory, arguments,
-    keyword_arguments, set_before_add, set_after_add, use_session=True):
-
-    class_  = SimpleViewClass(template, used_for=schema, bases=bases,
-                              name=name)
-
-    class_.schema = schema
-    class_.panes = panes
-    class_.fieldNames = fields
-    class_._factory_or_id = content_factory
-    class_._factory = property(_getFactory, _setFactory)
-    class_._arguments = arguments or []
-    class_._keyword_arguments = keyword_arguments or []
-    class_._set_before_add = set_before_add or []
-    class_._set_after_add = set_after_add or []
-    class_.use_session = use_session
-
-    class_.generated_form = ViewPageTemplateFile(default_template)
-
-    defineChecker(class_,
-                  NamesChecker(
-                    ("__call__", "__getitem__", "browserDefault"),
-                    permission,
-                    )
-                  )
-    if layer is None:
-        layer = IDefaultBrowserLayer
-
-    sm = zapi.getGlobalSiteManager()
-    sm.provideAdapter((for_, layer), Interface, name, class_)

Deleted: Zope3/trunk/src/zope/app/form/browser/editwizard.pt
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/editwizard.pt	2005-11-16 20:12:12 UTC (rev 40173)
+++ Zope3/trunk/src/zope/app/form/browser/editwizard.pt	2005-11-16 20:15:22 UTC (rev 40174)
@@ -1,69 +0,0 @@
-<tal:tag condition="view/update" />
-<html metal:use-macro="context/@@standard_macros/page"
-    i18n:domain="zope">
-  <body>
-    <div metal:fill-slot="body">
-
-      <div metal:define-macro="body">
-
-        <form action="." tal:attributes="action request/URL" method="post"
-              enctype="multipart/form-data" >
-
-          <div metal:define-macro="formbody">
-
-            <h3 tal:condition="view/label"
-                tal:content="view/label"
-                metal:define-slot="heading"
-                i18n:translate=""
-                >Edit something</h3>
-
-                <p tal:condition="view/feedback" tal:content="view/feedback" />
-
-                <div metal:define-slot="extra_info" tal:replace="nothing">
-                </div>
-
-                <div class="row"
-                     metal:define-slot="extra_top" tal:replace="nothing">
-                  <div class="label">Extra top</div>
-                  <div class="field"><input type="text" style="width:100%" /></div>
-                </div>
-
-                <div metal:use-macro="context/@@form_macros/widget_rows" />
-
-                <div class="row"
-                     metal:define-slot="extra_bottom" tal:replace="nothing">
-                  <div class="label">Extra bottom</div>
-                  <div class="field"><input type="text" style="width:100%" /></div>
-                </div>
-
-          </div>
-
-          <div class="row">
-            <div class="controls">
-              <!-- <input type="submit" value="Refresh"
-                   i18n:attributes="value refresh-button" /> -->
-              <input tal:condition="view/show_previous"
-                     type="submit" name="PREVIOUS_SUBMIT" value="Previous"
-                     i18n:attributes="value previous-button" />
-              <input tal:condition="view/show_submit"
-                     type="submit" name="UPDATE_SUBMIT" value="Submit"
-                     i18n:attributes="value submit-button"/>
-              <input tal:condition="view/show_next"
-                     type="submit" name="NEXT_SUBMIT" value="Next"
-                     i18n:attributes="value next-button" />
-            </div>
-          </div>
-          <div class="separator"></div>
-
-          <div tal:replace="structure view/renderHidden">
-            <!-- type=hidden input controls for passing state without session -->
-            <input type="hidden" name="example" value="foo" />
-          </div>
-        </form>
-
-      </div>
-
-    </div>
-  </body>
-
-</html>

Deleted: Zope3/trunk/src/zope/app/form/browser/editwizard.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/editwizard.py	2005-11-16 20:12:12 UTC (rev 40173)
+++ Zope3/trunk/src/zope/app/form/browser/editwizard.py	2005-11-16 20:15:22 UTC (rev 40174)
@@ -1,235 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Edit Wizard View Classes
-
-$Id$
-"""
-__docformat__ = 'restructuredtext'
-
-from zope.publisher.interfaces.browser import IDefaultBrowserLayer
-from zope.security.checker import defineChecker, NamesChecker
-
-from zope.app import zapi
-from zope.event import notify
-from zope.app.event.objectevent import ObjectModifiedEvent
-from zope.app.event.objectevent import Attributes
-from zope.app.i18n import ZopeMessageFactory as _
-from zope.app.pagetemplate.simpleviewclass import SimpleViewClass
-from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
-
-from editview import EditView
-from submit import Next, Previous, Update
-from zope.app.form.interfaces import WidgetInputError, WidgetsError
-from zope.app.form.utility \
-        import setUpWidgets, getWidgetsData, applyWidgetsChanges
-from zope.app.form.interfaces import IInputWidget
-
-
-PaneNumber = 'CURRENT_PANE_IDX'
-
-# TODO: Needs to be persistent aware for session (?)
-class WizardStorage(dict):
-    def __init__(self, fields, content):
-        super(WizardStorage, self).__init__(self)
-        if content:
-            for k in fields:
-                self[k] = getattr(content,k)
-
-    def __getattr__(self, key):
-        try:
-            return self[key]
-        except KeyError:
-            raise AttributeError(key)
-
-    def __setattr__(self, key, value):
-        self[key] = value
-
-
-class EditWizardView(EditView):
-
-    def _setUpWidgets(self):
-        self.adapted = self.schema(self.context)
-
-        if self.use_session:
-            # Need session for File upload fields
-            raise NotImplementedError('Cannot be implemented until we have an '
-                                      'ISessionDataManager')
-        else:
-            self.storage = WizardStorage(self.fieldNames, self.adapted)
-
-        # Add all our widgets as attributes on this view
-        setUpWidgets(self, self.schema, IInputWidget, initial=self.storage,
-                         names=self.fieldNames)
-
-    def widgets(self):
-        return [getattr(self, name+'_widget')
-            for name in self.currentPane().names
-            ]
-
-    _current_pane_idx = 0
-
-    def currentPane(self):
-        return self.panes[self._current_pane_idx]
-
-    _update_called = 0
-
-    # Message rendered at the top of the form, probably set by update()
-    feedback = u''
-
-    def update(self):
-        '''Called before rendering each pane. It is responsible
-        for extracting data into temporary storage, and selecting
-        which pane should be rendered.
-        '''
-        # Calling twice does nothing
-        if self._update_called:
-            return
-        self._update_called = 1
-
-        # Determine the current pane
-        if PaneNumber in self.request:
-            self._current_pane_idx = int(self.request[PaneNumber])
-            assert self._current_pane_idx >= 0
-            assert self._current_pane_idx < len(self.panes)
-        else:
-            # First page
-            self._current_pane_idx = 0
-            self.errors = {}
-            self.label = self.currentPane().label
-            self._choose_buttons()
-            return
-
-        # Validate the current pane, and set self.errors
-        try:
-            names = self.currentPane().names
-            data = getWidgetsData(self, self.schema, names=names)
-            self.errors = {}
-        except WidgetsError, errors:
-            x = {}
-            for k, label, msg in errors:
-                x[k] = msg
-            self.errors = x
-        else:
-
-            self.storage.update(data)
-
-            if Next in self.request:
-                self._current_pane_idx += 1
-                assert self._current_pane_idx < len(self.panes)
-            elif Previous in self.request:
-                self._current_pane_idx -= 1
-                assert self._current_pane_idx >= 0
-            elif Update in self.request:
-                if not self.use_session:
-                    # Data from panes other than the current one is still
-                    # stuck in request
-                    self.storage.update(getWidgetsData(
-                        self, self.schema, names=self.fieldNames))
-                if self.apply_update(self.storage):
-                    self.feedback = _(u'No changes to save')
-                else:
-                    self.feedback = _(u'Changes saved')
-
-        # Set the current label
-        self.label = self.currentPane().label
-
-        self._choose_buttons()
-
-    def _choose_buttons(self):
-        '''Determine what buttons appear when we render the current pane'''
-
-        # The submit button appears if every field on every pane except the
-        # current one has valid input or a valid default value.
-        # This is almost always the case for edit forms.
-        try:
-            for k in self.fieldNames:
-                if k not in self.currentPane().names:
-                    getattr(self, k+'_widget').getInputValue()
-            self.show_submit = 1
-        except WidgetInputError:
-            self.show_submit = 0
-
-        self.show_next = (self._current_pane_idx < len(self.panes) - 1)
-
-        self.show_previous = self._current_pane_idx > 0
-
-    def apply_update(self, storage):
-        ''' Save changes to our content object '''
-        for k,v in storage.items():
-            getattr(self,k+'_widget').setRenderedValue(v)
-        content = self.adapted
-        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:
-            description = Attributes(self.schema, *self.fieldNames)
-            notify(ObjectModifiedEvent(content, description))
-        return not changed
-
-    def renderHidden(self):
-        """Render state as hidden fields.
-
-        Also render hidden fields to propagate self.storage if we are not
-        using the session to do this.
-        """
-        olist = []
-        out = olist.append
-
-        # the index of the pane being rendered needs to be propagated
-        out('<input class="hiddenType" type="hidden" name="%s" value="%d" />'%(
-            PaneNumber, self._current_pane_idx
-            ))
-
-        if self.use_session:
-            # Need to output a unique key as a hidden field to identity this
-            # particular wizard. We use this to ensure data for this view
-            # doesn't conflict with other wizards in progress in other
-            # browser windows.
-            # Otherwise, no more state to propagate
-            raise NotImplementedError('use_session')
-
-        else:
-            current_fields = self.currentPane().names
-            for k in self.fieldNames:
-                if k not in current_fields:
-                    widget = getattr(self, k+'_widget')
-                    out(widget.hidden())
-            return ''.join(olist)
-
-
-def EditWizardViewFactory(name, schema, permission, layer,
-                    panes, fields, template, default_template, bases, for_,
-                    use_session=False):
-    class_ = SimpleViewClass(template, used_for=schema, bases=bases, name=name)
-    class_.schema = schema
-    class_.panes = panes
-    class_.fieldNames = fields
-    class_.use_session = use_session
-
-    class_.generated_form = ViewPageTemplateFile(default_template)
-
-    defineChecker(
-        class_,
-        NamesChecker(("__call__", "__getitem__", "browserDefault"), permission)
-        )
-
-    if layer is None:
-        layer = IDefaultBrowserLayer
-
-    # TODO: untested
-    sm = zapi.getGlobalSiteManager()
-    sm.provideAdapter((for_, layer), Interface, name, class_)
-
-

Modified: Zope3/trunk/src/zope/app/form/browser/meta.zcml
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/meta.zcml	2005-11-16 20:12:12 UTC (rev 40173)
+++ Zope3/trunk/src/zope/app/form/browser/meta.zcml	2005-11-16 20:15:22 UTC (rev 40174)
@@ -6,34 +6,6 @@
   <meta:directives namespace="http://namespaces.zope.org/browser">
 
     <meta:complexDirective
-        name="addwizard"
-        schema=".metadirectives.IAddWizardDirective"
-        handler=".metaconfigure.AddWizardDirective"
-        >
-
-      <meta:subdirective
-          name="pane"
-          schema=".metadirectives.IPaneSubdirective"
-          />
-
-    </meta:complexDirective>
-
-
-    <meta:complexDirective
-        name="editwizard"
-        schema=".metadirectives.IEditWizardDirective"
-        handler=".metaconfigure.EditWizardDirective"
-        >
-
-      <meta:subdirective
-          name="pane"
-          schema=".metadirectives.IPaneSubdirective"
-          />
-
-    </meta:complexDirective>
-
-
-    <meta:complexDirective
         name="form"
         schema=".metadirectives.IFormDirective"
         handler=".metaconfigure.FormDirective"

Modified: Zope3/trunk/src/zope/app/form/browser/metaconfigure.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/metaconfigure.py	2005-11-16 20:12:12 UTC (rev 40173)
+++ Zope3/trunk/src/zope/app/form/browser/metaconfigure.py	2005-11-16 20:15:22 UTC (rev 40174)
@@ -36,8 +36,6 @@
 from add import AddView, AddViewFactory
 from editview import EditView, EditViewFactory
 from formview import FormView
-from addwizard import AddWizardView, AddWizardViewFactory
-from editwizard import EditWizardView, EditWizardViewFactory
 from schemadisplay import DisplayView, DisplayViewFactory
 
 class BaseFormDirective(object):
@@ -72,7 +70,7 @@
         class_ = attrs.pop("class_", None)
         # Try to do better than accepting the string value by looking through
         # the interfaces and trying to find the field, so that we can use
-        # 'fromUnicode()' 
+        # 'fromUnicode()'
         if isinstance(class_, type):
             ifaces = implementedBy(class_)
             for name, value in kw.items():
@@ -86,12 +84,12 @@
             # attribute.  This can be used to override some of the
             # presentational attributes of the widget implementation.
             class_ = self._default_widget_factory
-        self._widgets[field+'_widget'] = CustomWidgetFactory(class_, **attrs) 
+        self._widgets[field+'_widget'] = CustomWidgetFactory(class_, **attrs)
 
     def _processWidgets(self):
         if self._widgets:
             customWidgetsObject = type('CustomWidgetsMixin', (object,),
-                                       self._widgets) 
+                                       self._widgets)
             self.bases = self.bases + (customWidgetsObject,)
 
     def _normalize(self):
@@ -134,42 +132,6 @@
                 self.layer)
 
 
-class Pane(object):
-    ''' Holder for information about a Pane of a wizard '''
-    # TODO: Add more funky stuff to each pane, such as a validator
-    def __init__(self, field_names, label):
-        self.names = field_names
-        self.label = label
-
-
-class BaseWizardDirective(BaseFormDirective):
-
-    # default wizard information
-    description = None
-    use_session = False
-
-    def __init__(self, _context, **kwargs):
-        super(BaseWizardDirective, self).__init__(_context, **kwargs)
-        self.panes = []
-
-    def _args(self):
-        permission = self.permission
-        if permission == 'zope.Public':
-            # Translate public permission to CheckerPublic
-            permission = CheckerPublic
-        return (self.name, self.schema, permission, self.layer,
-                self.panes, self.fields, self.template, self.default_template,
-                self.bases, self.for_)
-
-    def pane(self, _context, fields, label=''):
-        for f in fields:
-            if f not in self.fields:
-                raise ValueError(
-                    'Field name is not in schema',
-                    f, self.schema
-                    )
-        self.panes.append(Pane(fields, label))
-
 class AddFormDirective(BaseFormDirective):
 
     view = AddView
@@ -336,44 +298,7 @@
             args = self._args()+(self.fulledit_path, self.fulledit_label),
             )
 
-class AddWizardDirective(BaseWizardDirective, AddFormDirective):
 
-    view = AddWizardView
-    default_template = 'addwizard.pt'
-
-    def __call__(self):
-        self._handle_menu()
-        self._handle_content_factory()
-
-        all_fields = self.fields
-        leftover = []
-        for pane in self.panes:
-            leftover.extend(pane.names)
-        self.fields = leftover[:]
-        self._handle_arguments(leftover)
-        self.fields = all_fields
-
-        self._context.action(
-            discriminator = self._discriminator(),
-            callable = AddWizardViewFactory,
-            args = self._args()+(self.content_factory, self.arguments,
-                                 self.keyword_arguments, self.set_before_add,
-                                 self.set_after_add, self.use_session)
-            )
-
-class EditWizardDirective(BaseWizardDirective, EditFormDirective):
-
-    view = EditWizardView
-    default_template = 'editwizard.pt'
-
-    def __call__(self):
-        self._handle_menu()
-        self._context.action(
-            discriminator = self._discriminator(),
-            callable = EditWizardViewFactory,
-            args = self._args()+(self.menu, self.use_session)
-            )
-
 class SchemaDisplayDirective(EditFormDirective):
 
     view = DisplayView

Modified: Zope3/trunk/src/zope/app/form/browser/metadirectives.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/metadirectives.py	2005-11-16 20:12:12 UTC (rev 40173)
+++ Zope3/trunk/src/zope/app/form/browser/metadirectives.py	2005-11-16 20:15:22 UTC (rev 40174)
@@ -124,49 +124,10 @@
         value_type=PythonIdentifier()
         )
 
-class ICommonWizardInformation(ICommonInformation):
-    """
-    Common information for browser wizards
-    """
 
-    menu = MenuField(
-        title=u"The browser menu to include the form in.",
-        description=u"""
-        Many views are included in menus. It's convenient to name the
-        menu in the page directive, rather than having to give a
-        separate menuItem directive.""",
-        required=False
-        )
-
-    title = MessageID(
-        title=u"Menu title",
-        description=u"The browser menu label for the form.",
-        required=False
-        )
-
-    description = MessageID(
-        title=u"A longer description of the add form.",
-        description=u"""
-        A UI may display this with the item or display it when the
-        user requests more assistance.""",
-        required=False
-        )
-
-    use_session = Bool(
-        title=u"Use session",
-        description=u"""
-        If 'no', hidden input controls are used to maintain state
-        between panes in the wizard. Only simple data types can
-        be propagated with this method.
-
-        Defaults to 'no'.""",
-        default=False,
-        required=False
-        )
-
 class ICommonAddInformation(Interface):
     """
-    Common information for add forms/wizards
+    Common information for add forms
     """
 
     content_factory = GlobalObject(
@@ -221,53 +182,7 @@
         value_type=PythonIdentifier()
         )
 
-class IAddWizardDirective(ICommonWizardInformation, ICommonAddInformation):
-    """
-    Define an automatically generated add wizard (multi-page form)
 
-    The addwizard directive creates and registers a view for adding an
-    object based on a schema.
-
-    Adding an object is a bit trickier than editing an object, because
-    the object the schema applies to isn't available when forms are
-    being rendered.  The addwizard directive provides a customization
-    interface to overcome this difficulty.
-
-    See zope.app.browser.form.interfaces.IAddFormCustomization.
-    """
-
-class IEditWizardDirective(ICommonWizardInformation):
-    """
-    Define an automatically generated edit wizard (multi-page form).
-
-    The editwizard directive creates and registers a view for editing
-    an object based on a schema.
-    """
-
-    title = MessageID(
-        title=u"The browser menu label for the edit form",
-        description=u"This attribute defaults to 'Edit'.",
-        required=False
-        )
-
-class IPaneSubdirective(Interface):
-    """
-    Define a Pane (page) of the wizard
-    """
-
-    label = MessageID(
-        title=u"Label",
-        description=u"The label used as the heading on this pane",
-        required=False,
-        )
-
-    fields = Tokens(
-        title=u"Fields",
-        description=u"The fields to display on this pane of the wizard",
-        required=True,
-        value_type=PythonIdentifier()
-        )
-
 class IFormDirective(ICommonFormInformation):
     """
     Define an automatically generated form.
@@ -358,8 +273,8 @@
 
     This directive allows you to quickly generate custom widget directives for
     a form.
-    
-    Besides the two required arguments, field and class, you can specify any 
+
+    Besides the two required arguments, field and class, you can specify any
     amount of keyword arguments, e.g. style='background-color:#fefefe;'.
     The keywords will be stored as attributes on the widget instance. To see
     which keywords are sensible, you should look at the code of the specified

Deleted: Zope3/trunk/src/zope/app/form/browser/tests/test_editwizardview.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/tests/test_editwizardview.py	2005-11-16 20:12:12 UTC (rev 40173)
+++ Zope3/trunk/src/zope/app/form/browser/tests/test_editwizardview.py	2005-11-16 20:15:22 UTC (rev 40174)
@@ -1,124 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""$Id$
-"""
-import unittest
-
-from zope.interface import Interface, implements
-from zope.publisher.browser import TestRequest
-from zope.schema import TextLine, accessors
-from zope.schema.interfaces import ITextLine
-from zope.security.checker import InterfaceChecker, ProxyFactory
-
-from zope.app.testing import ztapi
-from zope.app.testing.placelesssetup import PlacelessSetup
-
-from zope.app.form.browser.editwizard import EditWizardView
-from zope.app.form.browser import TextWidget
-from zope.app.form.interfaces import IInputWidget
-from zope.app.location.interfaces import ILocation
-from zope.app.form.tests import utils
-
-class I(Interface):
-    foo = TextLine(title=u"Foo")
-    bar = TextLine(title=u"Bar")
-    a   = TextLine(title=u"A")
-    b   = TextLine(title=u"B", min_length=0, required=False)
-    getbaz, setbaz = accessors(TextLine(title=u"Baz"))
-
-class EV(EditWizardView):
-    schema = I
-    object_factories = []
-    use_session = None
-
-class C(object):
-    implements(I)
-    __Security_checker__ = utils.SchemaChecker(I)
-    foo = u"c foo"
-    bar = u"c bar"
-    a   = u"c a"
-    b   = u"c b"
-    _baz = u"c baz"
-    def getbaz(self): return self._baz
-    def setbaz(self, v): self._baz = v
-
-
-class IFoo(Interface):
-    foo = TextLine(title=u"Foo")
-
-class IBar(Interface):
-    bar = TextLine(title=u"Bar")
-
-class Foo(object):
-    implements(IFoo)
-    __Security_checker__ = utils.SchemaChecker(IFoo)
-    foo = u'Foo foo'
-    
-class ConformFoo(object):
-    implements(IFoo)
-
-    foo = u'Foo foo'
-
-    def __conform__(self, interface):
-        if interface is IBar:
-            return OtherFooBarAdapter(self)
-
-            
-class FooBarAdapter(object):
-    implements(IBar, ILocation)
-    __used_for__ = IFoo
-    __Security_checker__ = utils.SchemaChecker(IBar)
-    def __init__(self, context):
-        self.context = context
-
-    def getbar(self): return self.context.foo
-    def setbar(self, v): self.context.foo = v
-
-    bar = property(getbar, setbar)
-    
-class OtherFooBarAdapter(FooBarAdapter):
-    pass
-
-class BarV(EditWizardView):
-    schema = IBar
-    object_factories = []
-    use_session = None
-
-class Test(PlacelessSetup, unittest.TestCase):
-
-    def setUp(self):
-        super(Test, self).setUp()
-        ztapi.browserViewProviding(ITextLine, TextWidget, IInputWidget)
-        ztapi.provideAdapter(IFoo, IBar, FooBarAdapter)
-
-    def test_setUpWidget(self):
-        c = C()
-        request = TestRequest()
-        v = EV(c, request)
-
-    def test_setUpWidget_via_adapter(self):
-        f = Foo()
-        request = TestRequest()
-        v = BarV(f, request)
-
-    def test_setUpWidget_via_conform_adapter(self):        
-        f = ConformFoo()
-        request = TestRequest()
-        v = BarV(f, request)
-        
-def test_suite():
-    return unittest.makeSuite(Test)
-
-if __name__=='__main__':
-    unittest.main(defaultTest='test_suite')



More information about the Zope3-Checkins mailing list