[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form - metadirectives.py:1.1 add.py:1.25 addwizard.py:1.5 editview.py:1.30 editwizard.py:1.8 meta.zcml:1.18 schemadisplay.py:1.6

Philipp von Weitershausen philikon@philikon.de
Sat, 2 Aug 2003 03:04:33 -0400


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

Modified Files:
	add.py addwizard.py editview.py editwizard.py meta.zcml 
	schemadisplay.py 
Added Files:
	metadirectives.py 
Log Message:
Converted the three most important packages that define ZCML directives
to the new ZCML architecture (using schemas):

- zope.app.component

- zope.app.browser

- zope.app.publisher.browser


=== Added File Zope3/src/zope/app/browser/form/metadirectives.py ===
##############################################################################
#
# 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.0 (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: metadirectives.py,v 1.1 2003/08/02 07:03:55 philikon Exp $
"""

from zope.interface import Interface
from zope.configuration.fields import GlobalObject, Tokens, Path, \
     Bool, PythonIdentifier
from zope.schema import Text, TextLine

from zope.app.component.metadirectives import IBasicViewInformation

class ICommonInformation(Interface):
    """
    Common information for all successive directives
    """

    name = TextLine(
        title=u"Name",
        description=u"The name of the generated view.",
        required=True
        )

    schema = GlobalObject(
        title=u"Schema",
        description=u"The schema from which the form is generated.",
        required=True
        )

    for_ = GlobalObject(
        title=u"Interface",
        description=u"""
        The interface this page (view) applies to.

        The view will be for all objects that implement this
        interface. The schema is used if the for attribute is not
        specified.

        If the for attribute is specified, then the objects views must
        implement or be adaptable to the schema.""",
        required=False
        )

    permission = TextLine(
        title=u"Permission",
        description=u"The permission needed to use the view.",
        required=True
        )

    layer = TextLine(
        title=u"Layer",
        description=u"The later the view is in. Default: 'default'",
        required=False
        )

    template = Path(
        title=u"Template",
        description=u"An alternate template to use for the form.",
        required=False
        )

    class_ = GlobalObject(
        title=u"Class",
        description=u"""
        A class to provide custom widget definitions or methods to be
        used by a custom template.

        This class is used as a mix-in class. As a result, it needn't
        subclass any special classes, such as BrowserView.""",
        required=False
        )

class ICommonFormInformation(ICommonInformation):
    """
    Common information for browser forms
    """

    title = TextLine(
        title=u"Title",
        description=u"The browser menu label for the form.",
        required=False
        )

    label = TextLine(
        title=u"Label",
        description=u"A label to be used as the heading for the form.",
        required=False
        )

    menu = TextLine(
        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
        )

    fields = Tokens(
        title=u"Fields",
        description=u"""
        The fields and the order in which to display them.  If this is
        not specified, all schema fields will be displayed in the
        order specified in the schema itself.""",
        required=False,
        value_type=PythonIdentifier()
        )

class ICommonWizardInformation(ICommonInformation):
    """
    Common information for browser wizards
    """

    menu = TextLine(
        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
        )

    description = Text(
        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 'yes'.""",
        required=False
        )

class ICommonAddInformation(Interface):
    """
    Common information for add forms/wizards
    """

    content_factory = GlobalObject(
        title=u"Content factory",
        description=u"""
        An object to call to create new content objects.

        This attribute isn't used if a class is specified that
        implements createAndAdd.""",
        required=False
        )

    arguments = Tokens(
        title=u"Arguments",
        description=u"""
        A list of field names to supply as positional arguments to the
        factory.""",
        required=False,
        value_type=PythonIdentifier()
        )

    keyword_arguments = Tokens(
        title=u"Keyword arguments",
        description=u"""
        A list of field names to supply as keyword arguments to the
        factory.""",
        required=False,
        value_type=PythonIdentifier()
        )

    set_before_add = Tokens(
        title=u"Set before add",
        description=u"""
        A list of fields to be assigned to the newly created object
        before it is added.""",
        required=False,
        value_type=PythonIdentifier()        
        )

    set_after_add = Tokens(
        title=u"Set after add",
        description=u"""
        A list of fields to be assigned to the newly created object
        after it is added.""",
        required=False,
        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 an customization
    interface to overcome this difficulty.

    See zope.app.interfaces.browser.form.IAddFormCustomization.
    """

class IEditWizardDirective(ICommonWizardInformation):
    """
    Define an automatically generated edit wizard (multi-page form).

    The editwizard directive creates and register's a view for editing
    an object based on a schema.
    """

    title = TextLine(
        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 = TextLine(
        title=u"Label",
        description=u"The label used as the heading on this pane",
        required=False,
        )

class IEditFormDirective(ICommonFormInformation):
    """
    Define an automatically generated edit form

    The editform directive creates and register's a view for editing
    an object based on a schema.
    """

#XXX this is sooo not used
class ISubeditFormDirective(ICommonInformation):
    """
    Define a subedit form
    """

    label = TextLine(
        title=u"Label",
        description=u"A label to be used as the heading for the form.",
        required=False
        )

    #XXX what's this?
    fulledit = Text()

    #XXX what's this?
    fulledit_label = Text()

class IAddFormDirective(ICommonFormInformation, ICommonAddInformation):
    """
    Define an automatically generated add form

    The addform 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 addform directive provides an customization
    interface to overcome this difficulty.

    See zope.app.interfaces.browser.form.IAddFormCustomization.
    """

    description = Text(
        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
        )

class ISchemaDisplayDirective(ICommonFormInformation):
    """
    Define an automatically generated display form.

    The schemadisplay directive creates and register's a view for
    displaying an object based on a schema.
    """

    title = TextLine(
        title=u"The browser menu label for the edit form",
        description=u"This attribute defaults to 'Edit'.",
        required=False
        )


=== Zope3/src/zope/app/browser/form/add.py 1.24 => 1.25 ===
--- Zope3/src/zope/app/browser/form/add.py:1.24	Mon Jul 14 05:45:02 2003
+++ Zope3/src/zope/app/browser/form/add.py	Sat Aug  2 03:03:55 2003
@@ -19,11 +19,11 @@
 
 from zope.schema.interfaces import ValidationError
 
+from zope.app.interfaces.container import IAdding
 from zope.app.event import publish
 from zope.app.event.objectevent import ObjectCreatedEvent
 from zope.app.interfaces.form import WidgetsError
 from zope.app.form.utility import setUpWidgets, getWidgetsData
-from zope.configuration.action import Action
 from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
 from zope.security.checker import defineChecker, NamesChecker
 from zope.component import getAdapter
@@ -81,13 +81,15 @@
         """
         
         args = []
-        for name in self._arguments:
-            args.append(data[name])
+        if self._arguments:
+            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]
+        if self._keyword_arguments:
+            for name in self._keyword_arguments:
+                if name in data:
+                    kw[str(name)] = data[name]
 
         content = self.create(*args, **kw)
         adapted = getAdapter(content, self.schema, context=self.context)
@@ -165,12 +167,10 @@
 
 def add(_context, name, schema, content_factory='', label='',
         permission = 'zope.Public', layer = "default",
-        class_ = None, for_ = 'zope.app.interfaces.container.IAdding',
-        template = None, omit=None, fields=None,
-        arguments='', keyword_arguments='',
-        set_before_add='', set_after_add='',
-        menu=None, title=None, description='',
-        ):
+        class_ = None, for_ = IAdding,
+        template = None, fields=None, arguments=None, keyword_arguments=None,
+        set_before_add=None, set_after_add=None,
+        menu=None, title=None, description=''):
 
     # Handle menu attrs. We do this now to rather than later becaise
     # menuItemDirective expects a dotted name for for_. 
@@ -178,24 +178,16 @@
         if (not menu) or (not title):
             raise ValueError("If either menu or title are specified, "
                              "they must both be specified")
-        actions = menuItemDirective(
+        menuItemDirective(
             _context, menu, for_, '@@' + name, title,
             permission=permission, description=description)
-    else:
-        actions = []
-
-
-    content_factory = (content_factory and _context.resolve(content_factory)
-                       or None)
 
-    schema, for_, bases, template, fields = normalize(
-        _context, schema, for_, class_, template, 'add.pt', fields, omit,
-        AddView)
+    for_, bases, template, fields = normalize(
+        for_, schema, class_, template, 'add.pt', fields, AddView)
 
     leftover = fields
 
     if arguments:
-        arguments = arguments.split()
         missing = [n for n in arguments if n not in fields]
         if missing:
             raise ValueError("Some arguments are not included in the form",
@@ -208,7 +200,6 @@
         leftover = [n for n in leftover if n not in arguments]
 
     if keyword_arguments:
-        keyword_arguments = keyword_arguments.split()
         missing = [n for n in keyword_arguments if n not in fields]
         if missing:
             raise ValueError(
@@ -217,7 +208,6 @@
         leftover = [n for n in leftover if n not in keyword_arguments]
 
     if set_before_add:
-        set_before_add = set_before_add.split()
         missing = [n for n in set_before_add if n not in fields]
         if missing:
             raise ValueError(
@@ -226,7 +216,6 @@
         leftover = [n for n in leftover if n not in set_before_add]
 
     if set_after_add:
-        set_after_add = set_after_add.split()
         missing = [n for n in set_after_add if n not in fields]
         if missing:
             raise ValueError(
@@ -237,19 +226,12 @@
         set_after_add += leftover
 
     else:
-
         set_after_add = leftover
 
-        
-
-    actions += [
-        Action(
+    _context.action(
         discriminator = ('view', for_, name, IBrowserPresentation, layer),
         callable = AddViewFactory,
         args = (name, schema, label, permission, layer, template, 'add.pt',
                 bases, for_, fields, content_factory, arguments,
                 keyword_arguments, set_before_add, set_after_add),
         )
-        ]
-
-    return actions


=== Zope3/src/zope/app/browser/form/addwizard.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/browser/form/addwizard.py:1.4	Mon Jul 28 18:20:58 2003
+++ Zope3/src/zope/app/browser/form/addwizard.py	Sat Aug  2 03:03:55 2003
@@ -24,7 +24,6 @@
 from zope.app.event.objectevent import ObjectCreatedEvent
 from zope.app.interfaces.form import WidgetsError
 from zope.app.form.utility import setUpWidgets, getWidgetsData
-from zope.configuration.action import Action
 from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
 from zope.security.checker import defineChecker, NamesChecker
 from zope.component import getAdapter
@@ -176,21 +175,16 @@
             if (not menu) or (not title):
                 raise ValueError("If either menu or title are specified, "
                                 "they must both be specified")
-            actions = menuItemDirective(
+            menuItemDirective(
                 _context, menu, for_, '@@' + name, title,
                 permission=permission, description=description)
-        else:
-            actions = []
 
-        self.content_factory = (
-            content_factory and _context.resolve(content_factory) or None
-            )
+        self.content_factory = content_factory
 
-        schema, for_, bases, template, fields = normalize(
-            _context, schema, for_, class_, template, 'addwizard.pt', 
-            fields=None, omit=None, view=AddWizardView
-            )
+        for_, bases, template, fields = normalize(
+            for_, schema, class_, template, 'addwizard.pt', view=AddWizardView)
 
+        self._context = _context
         self.schema = schema
         self.for_ = for_
         self.bases = bases
@@ -201,10 +195,8 @@
         self.keyword_arguments = keyword_arguments
  
         self.panes = []
-        self.actions = actions
 
     def pane(self, _context, fields, label=''):
-        fields = [str(f) for f in fields.split(' ')]
         for f in fields:
             if f not in self.all_fields:
                 raise ValueError(
@@ -212,7 +204,6 @@
                     name, self.schema
                     )
         self.panes.append(Pane(fields, label))
-        return []
 
     def __call__(self):
 
@@ -224,7 +215,6 @@
 
         arguments = self.arguments
         if arguments:
-            arguments = arguments.split()
             missing = [n for n in arguments if n not in fields]
             if missing:
                 raise ValueError("Some arguments are not included in the form",
@@ -238,7 +228,6 @@
 
         keyword_arguments = self.keyword_arguments
         if keyword_arguments:
-            keyword_arguments = keyword_arguments.split()
             missing = [n for n in keyword_arguments if n not in fields]
             if missing:
                 raise ValueError(
@@ -248,7 +237,6 @@
 
         set_before_add = self.set_before_add
         if set_before_add:
-            set_before_add = set_before_add.split()
             missing = [n for n in set_before_add if n not in fields]
             if missing:
                 raise ValueError(
@@ -258,7 +246,6 @@
 
         set_after_add = self.set_after_add
         if set_after_add:
-            set_after_add = set_after_add.split()
             missing = [n for n in set_after_add if n not in fields]
             if missing:
                 raise ValueError(
@@ -272,22 +259,13 @@
 
             set_after_add = leftover
 
-        self.actions.append(
-            Action(
-                discriminator=(
-                    'view', self.for_, self.name, IBrowserPresentation, 
-                    self.layer
-                    ),
-                callable=AddWizardViewFactory,
-                args=(
-                    self.name, self.schema, self.permission, self.layer, 
-                    self.panes, self.all_fields, self.template, 'editwizard.pt',
-                    self.bases, self.for_, self.content_factory, arguments,
-                    keyword_arguments, self.set_before_add, self.set_after_add,
-                    self.use_session,
-                    )
-                )
+        self._context.action(
+            discriminator=('view', self.for_, self.name, IBrowserPresentation, 
+                           self.layer),
+            callable=AddWizardViewFactory,
+            args=(self.name, self.schema, self.permission, self.layer, 
+                  self.panes, self.all_fields, self.template, 'editwizard.pt',
+                  self.bases, self.for_, self.content_factory, arguments,
+                  keyword_arguments, self.set_before_add, self.set_after_add,
+                  self.use_session)
             )
-        return self.actions
-
-


=== Zope3/src/zope/app/browser/form/editview.py 1.29 => 1.30 ===
--- Zope3/src/zope/app/browser/form/editview.py:1.29	Mon Jul 14 20:55:21 2003
+++ Zope3/src/zope/app/browser/form/editview.py	Sat Aug  2 03:03:55 2003
@@ -25,7 +25,6 @@
 
 from zope.interface import classProvides, implements
 
-from zope.configuration.action import Action
 from zope.app.context import ContextWrapper
 from zope.publisher.interfaces.browser import IBrowserPresentation
 from zope.publisher.browser import BrowserView
@@ -34,7 +33,6 @@
 from zope.component import getAdapter
 
 from zope.app.interfaces.form import WidgetsError
-from zope.app.component.metaconfigure import resolveInterface
 from zope.app.form.utility import setUpEditWidgets, applyWidgetsChanges
 from zope.app.browser.form.submit import Update
 from zope.app.event import publish
@@ -45,7 +43,6 @@
 from zope.app.publisher.browser.globalbrowsermenuservice \
      import menuItemDirective, globalBrowserMenuService
 
-
 class EditView(BrowserView):
     """Simple edit-view base class
 
@@ -62,7 +59,6 @@
 
     def __init__(self, context, request):
         super(EditView, self).__init__(context, request)
-
         self._setUpWidgets()
 
     def _setUpWidgets(self):
@@ -117,7 +113,6 @@
         self.update_status = status
         return status
 
-
 def EditViewFactory(name, schema, label, permission, layer,
                     template, default_template, bases, for_, fields,
                     fulledit_path=None, fulledit_label=None, menu=u'',
@@ -146,93 +141,68 @@
     provideView(for_, name, IBrowserPresentation, class_, layer)
 
 
-def normalize(_context, schema_, for_, class_, template, default_template,
-              fields, omit, view=EditView):
-    schema = resolveInterface(_context, schema_)
-
+def normalize(for_, schema, class_, template, default_template, fields, view=EditView):
     if for_ is None:
         for_ = schema
-    else:
-        for_ = resolveInterface(_context, for_)
 
     if class_ is None:
         bases = view,
     else:
-        # XXX What about class_.__implements__ ?
-        bases = _context.resolve(class_), view
+        bases = (class_, view)
 
     if template is not None:
-        template = _context.path(template)
         template = os.path.abspath(str(template))
         if not os.path.isfile(template):
             raise ConfigurationError("No such file", template)
     else:
         template = default_template
 
-
-
     names = getFieldNamesInOrder(schema)
 
     if fields:
-        fields = fields.split()
         for name in fields:
             if name not in names:
                 raise ValueError("Field name is not in schema",
-                                 name, schema_)
+                                 name, schema)
     else:
         fields = names
 
-    if omit:
-        omit = omit.split()
-        for name in omit:
-            if name not in names:
-                raise ValueError("Field name is not in schema",
-                                 name, schema_)
-        fields = [name for name in fields if name not in omit]
-
-    return schema, for_, bases, template, fields
+    return (for_, bases, template, fields)
 
 def edit(_context, name, schema, permission, label='',
-         layer = "default",
-         class_ = None, for_ = None,
-         template = None, omit=None, fields=None,
+         layer = "default", class_ = None, for_ = None,
+         template = None, fields=None,
          menu=None, title='Edit', usage=u''):
 
     if menu:
-        actions = menuItemDirective(
+        menuItemDirective(
             _context, menu, for_ or schema, '@@' + name, title,
             permission=permission)
-    else:
-        actions = []
 
-    schema, for_, bases, template, fields = normalize(
-        _context, schema, for_, class_, template, 'edit.pt', fields, omit)
+    for_, bases, template, fields = normalize(
+        for_, schema, class_, template, 'edit.pt', fields)
 
-    actions.append(
-        Action(
-        discriminator=('view', for_, name, IBrowserPresentation, layer),
+    _context.action(
+        #XXX added schema to descriminator to make it unique
+        # don't know whether that's a Good Thing(tm) -- philiKON
+        discriminator=('view', for_, name, schema,
+                       IBrowserPresentation, layer),
         callable=EditViewFactory,
         args=(name, schema, label, permission, layer, template, 'edit.pt',
               bases, for_, fields, menu, usage),
         )
-        )
-
-    return actions
 
 def subedit(_context, name, schema, label,
             permission='zope.Public', layer="default",
-            class_=None, for_=None,
-            template=None, omit=None, fields=None,
+            class_=None, for_=None, template=None, fields=None,
             fulledit=None, fulledit_label=None):
 
-    schema, for_, bases, template, fields = normalize(
-        _context, schema, for_, class_, template, 'subedit.pt', fields, omit)
+    for_, bases, template, fields = normalize(
+        for_, schema, class_, template, 'subedit.pt', fields)
 
-    return [
-        Action(
+    _context.action(
         discriminator=('view', for_, name, IBrowserPresentation, layer),
         callable=EditViewFactory,
         args=(name, schema, label, permission, layer, template, 'subedit.pt',
               bases, for_, fields, fulledit, fulledit_label),
         )
-        ]


=== Zope3/src/zope/app/browser/form/editwizard.py 1.7 => 1.8 ===
--- Zope3/src/zope/app/browser/form/editwizard.py:1.7	Mon Jul 28 18:20:58 2003
+++ Zope3/src/zope/app/browser/form/editwizard.py	Sat Aug  2 03:03:55 2003
@@ -22,7 +22,6 @@
 from zope.component import getAdapter
 from zope.app.publisher.browser.globalbrowsermenuservice \
      import menuItemDirective, globalBrowserMenuService
-from zope.configuration.action import Action
 from zope.app.pagetemplate.simpleviewclass import SimpleViewClass
 from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
 from editview import normalize, EditViewFactory, EditView
@@ -249,11 +248,10 @@
         else:
             actions = []
 
-        schema, for_, bases, template, fields = normalize(
-            _context, schema, for_, class_, template, 'editwizard.pt', 
-            fields=None, omit=None, view=EditWizardView
-            )
+        for_, bases, template, fields = normalize(
+            for_, schema, class_, template, 'editwizard.pt', view=EditWizardView)
 
+        self._context = _context
         self.schema = schema
         self.for_ = for_
         self.bases = bases
@@ -264,8 +262,6 @@
         self.actions = actions
 
     def pane(self, _context, fields, label=''):
-        fields = [str(f) for f in fields.split(' ')]
-
         for f in fields:
             if f not in self.all_fields:
                 raise ValueError(
@@ -273,25 +269,16 @@
                     name, self.schema
                     )
         self.panes.append(Pane(fields, label))
-        return []
 
     def __call__(self):
-        self.actions.append(
-            Action(
-                discriminator=(
-                    'view', self.for_, self.name, IBrowserPresentation, 
-                    self.layer
-                    ),
-                callable=EditWizardViewFactory,
-                args=(
-                    self.name, self.schema, self.permission, self.layer, 
-                    self.panes, self.all_fields, self.template, 'editwizard.pt',
-                    self.bases, self.for_, self.menu, u'', self.use_session
-                    )
-                )
+        self._context.action(
+            discriminator=(
+            'view', self.for_, self.name, IBrowserPresentation, self.layer),
+            callable=EditWizardViewFactory,
+            args=(self.name, self.schema, self.permission, self.layer, 
+                  self.panes, self.all_fields, self.template, 'editwizard.pt',
+                  self.bases, self.for_, self.menu, u'', self.use_session)
             )
-        return self.actions
-
 
 def EditWizardViewFactory(name, schema, permission, layer,
                     panes, fields, template, default_template, bases, for_, 


=== Zope3/src/zope/app/browser/form/meta.zcml 1.17 => 1.18 ===
--- Zope3/src/zope/app/browser/form/meta.zcml:1.17	Mon Jul 28 18:21:13 2003
+++ Zope3/src/zope/app/browser/form/meta.zcml	Sat Aug  2 03:03:55 2003
@@ -1,674 +1,60 @@
-<zopeConfigure xmlns='http://namespaces.zope.org/zope'>
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:meta="http://namespaces.zope.org/meta"
+    >
+
+  <meta:directives namespace="http://namespaces.zope.org/browser">
+
+    <meta:complexDirective
+        name="addwizard"
+        schema=".metadirectives.IAddWizardDirective"
+        handler="zope.app.browser.form.addwizard.AddWizardDirective"
+        >
+
+      <meta:subdirective
+          name="pane"
+          schema=".metadirectives.IPaneSubdirective"
+          />
+
+    </meta:complexDirective>
+
+    <meta:complexDirective
+        name="editwizard"
+        schema=".metadirectives.IEditWizardDirective"
+        handler="zope.app.browser.form.editwizard.EditWizardDirective"
+        >
+
+      <meta:subdirective
+          name="pane"
+          schema=".metadirectives.IPaneSubdirective"
+          />
+
+    </meta:complexDirective>
+
+    <meta:directive
+        name="editform"
+        schema=".metadirectives.IEditFormDirective"
+        handler=".editview.edit"
+        />
+
+    <meta:directive
+        name="subeditform"
+        schema=".metadirectives.ISubeditFormDirective"
+        handler=".editview.subedit"
+        />
+
+    <meta:directive
+        name="addform"
+        schema=".metadirectives.IAddFormDirective"
+        handler=".add.add"
+        />
+
+    <meta:directive
+        name="schemadisplay"
+        schema=".metadirectives.ISchemaDisplayDirective"
+        handler=".schemadisplay.display"
+        />
 
-  <directives namespace="http://namespaces.zope.org/browser">
+  </meta:directives>
 
-    <directive name="addwizard"
-       handler="zope.app.browser.form.addwizard.AddWizardDirective">
-
-      <description>
-        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 an
-        customization interface to overcome this difficulty.
-
-        See zope.app.interfaces.browser.form.IAddFormCustomization.
-      </description>
-
-      <attribute name="name" required="yes">
-        <description>
-          The name of the generated add view.
-        </description>
-      </attribute>
-
-      <attribute name="schema" required="yes">
-        <description>
-        The schema from which the add form is generated.
-
-        A schema is an interface that includes fields.
-        </description>
-      </attribute>
-
-      <attribute name="for" required="no">
-        <description>
-        The interface this page (view) applies to.
-
-        The view will be for all objects that implement this interface.
-
-        zope.app.interfaces.container.IAdding is used if this
-        attribute isn't specified.  If this attribute is specified,
-        then either the named interface must extend IAdding or a class
-        attribute must be used to supply a class implements certain
-        methods described in
-        zope.app.interfaces.browser.form.IAddFormCustomization.
-
-        The schema is used if the for attribute is not specified.
-
-        If the for attribute is specified, then the objects views must
-        implement or be adaptable to the schema.
-        </description>
-      </attribute>
-
-      <attribute name="layer" required="no">
-        <description>
-          The layer the view is in.
-
-          A skin is composed of layers. It is common to put skin specific
-          views in a layer named after the skin. If the 'layer' attribute
-          is not supplied, it defaults to 'default'.
-        </description>
-      </attribute>
-
-      <attribute name="permission" required="yes">
-        <description>
-          The permission needed to use the view. 
-        </description>
-      </attribute>
-
-      <attribute name="template" required="no">
-        <description>
-          An alternate template to use for the add form.
-
-          XXX Need to document how to extend the default.
-        </description>
-      </attribute>
-
-      <attribute name="class" required="no">
-        <description>
-          A class to provide custom widget definitions or methods to be
-          used by a custom template.
-
-          This class can override methods defined in IAddFormCustomization.
-
-          This class is used as a mix-in class. As a result, it needn't
-          subclass any special classes, such as BrowserView.
-        </description>
-      </attribute>
-
-      <attribute name="content_factory" required="no">
-        <description>
-          The dotted name of an object to call to create new content objects.
-
-          This attribute isn't used if a class is specified that
-          implements createAndAdd.
-          </description>
-        </attribute>
-
-      <attribute name="arguments" required="no">
-        <description>
-          A list of field names to supply as positional arguments to
-          the factory.
-        </description>
-      </attribute>
-
-      <attribute name="keyword_arguments" required="no">
-        <description>
-          A list of field names to supply as keyword arguments to
-          the factory.
-        </description>
-      </attribute>
-
-      <attribute name="set_before_add" required="no">
-        <description>
-          A list of fields to be assigned to the newly created object
-          before it is added.
-        </description>
-      </attribute>
-
-      <attribute name="set_after_add" required="no">
-        <description>
-          A list of fields to be assigned to the newly created object
-          after it is added.
-        </description>
-      </attribute>
-
-      <attribute name="menu" required="no">
-        <description>
-          The browser menu to include the add form in.
-
-          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.
-        </description>
-      </attribute>
-
-      <attribute name="description" required="no">
-        <description>
-         A longer description of the add form.
-
-          A UI may display this with the item or display it when the
-          user requests more assistance.
-        </description>
-        </attribute>
-
-
-      <attribute name="use_session" required="no">
-        <description>
-          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 'yes'.
-        </description>
-      </attribute>
-
-      <subdirective name="pane" 
-        description="Define a Pane (page) of the wizard">
-        <attribute name="fields" required="yes">
-          <description>
-            The fields and the order in which to display them.  If this
-            is not specified, all schema fields will be displayed in the
-            order specified in the schema itself.
-          </description>
-        </attribute>
-        <attribute name="label" required="no">
-          <description>
-            The label used as the heading on this pane
-          </description>
-        </attribute>
-      </subdirective>
-
-    </directive>
-
-    <directive name="editwizard" handler=".editwizard.EditWizardDirective">
-      <description>
-        Define an automatically generated edit wizard (multi-page form).
-
-        The editwizard directive creates and register's a view for
-        editing an object based on a schema.
-      </description>
-
-      <attribute name="name" required="yes">
-        <description>
-        The name of the generated View
-        </description>
-      </attribute>
-
-      <attribute name="schema" required="yes">
-        <description>
-        The schema from which the edit form is generated.
-
-        A schema is an interface that includes fields.
-        </description>
-      </attribute>
-
-      <attribute name="for" required="no">
-        <description>
-        The interface this page (view) applies to. 
-
-        The view will be for all objects that implement this interface.
-
-        The schema is used if the for attribute is not specified.
-
-        If the for attribute is specified, then the objects views must
-        implement or be adaptable to the schema.
-        </description>
-      </attribute>
-
-      <attribute name="permission" required="yes">
-        <description>
-        The permission needed to use the view. 
-        </description>
-      </attribute>
-
-      <attribute name="template" required="no">
-        <description>
-        An alternate template to use for the edit form.
-
-        XXX Need to document how to extend the default.
-        </description>
-      </attribute>
-
-      <attribute name="layer" required="no">
-        <description>
-          The layer the view is in. 
-
-          A skin is composed of layers. It is common to put skin specific
-          views in a layer named after the skin. If the 'layer' attribute
-          is not supplied, it defaults to 'default'. 
-        </description>
-      </attribute>
-
-      <attribute name="class" required="no">
-        <description>
-        A class to provide custom widget definitions or methods to be
-        used by a custom template.
-
-        This class is used as a mix-in class. As a result, it needn't
-        subclass any special classes, such as BrowserView.
-        </description>
-        </attribute>
-
-      <attribute name="menu" required="no">
-        <description>
-          The browser menu to include the edit form in.
-
-          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.
-          </description>
-        </attribute>
-
-      <attribute name="title" required="no">
-        <description>
-          The browser menu label for the edit form
-
-          This attribute defaults to "Edit".
-          </description>
-      </attribute>
-
-      <attribute name="use_session" required="no">
-        <description>
-          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 'yes'.
-        </description>
-      </attribute>
-
-      <subdirective name="pane" 
-        description="Define a Pane (page) of the wizard">
-        <attribute name="fields" required="yes">
-          <description>
-          The fields and the order in which to display them.  If this
-          is not specified, all schema fields will be displayed in the
-          order specified in the schema itself.
-          </description>
-        </attribute>
-        <attribute name="label" required="no">
-          <description>
-          The label used as the heading on this pane
-          </description>
-        </attribute>
-      </subdirective>
-
-    </directive>
-
-    <directive name="editform" handler=".editview.edit">
-
-      <description>
-        Define an automatically generated edit form
-
-        The editform directive creates and register's a view for
-        editing an object based on a schema.
-      </description>
-
-      <attribute name="name" required="yes">
-        <description>
-        The name of the generated edit view.
-        </description>
-        </attribute>
-
-      <attribute name="schema" required="yes">
-        <description>
-        The schema from which the edit form is generated.
-
-        A schema is an interface that includes fields.
-        </description>
-        </attribute>
-
-      <attribute name="label" required="no">
-        <description>
-        A label to be used as the heading for the form.
-        </description>
-        </attribute>
-
-      <attribute name="for" required="no">
-        <description>
-        The interface this page (view) applies to. 
-
-        The view will be for all objects that implement this interface.
-
-        The schema is used if the for attribute is not specified.
-
-        If the for attribute is specified, then the objects views must
-        implement or be adaptable to the schema.
-        </description>
-        </attribute>
-
-      <attribute name="fields" required="no">
-        <description>
-        The fields and the order in which to display them.  If this
-        is not specified, all schema fields will be displayed in the
-        order specified in the schema itself.
-        </description>
-      </attribute>
-
-      <attribute name="layer" required="no">
-        <description>
-              The layer the view is in. 
-
-              A skin is composed of layers. It is common to put skin specific
-              views in a layer named after the skin. If the 'layer' attribute
-              is not supplied, it defaults to 'default'. 
-          </description>
-        </attribute>
-
-
-       <attribute name="permission" required="yes">
-        <description>
-              The permission needed to use the view. 
-          </description>
-        </attribute>
-
-      <attribute name="template" required="no">
-        <description>
-        An alternate template to use for the edit form.
-
-        XXX Need to document how to extend the default.
-        </description>
-        </attribute>
-
-      <attribute name="class" required="no">
-        <description>
-        A class to provide custom widget definitions or methods to be
-        used by a custom template.
-
-        This class is used as a mix-in class. As a result, it needn't
-        subclass any special classes, such as BrowserView.
-        </description>
-        </attribute>
-
-
-      <attribute name="menu" required="no">
-        <description>
-          The browser menu to include the edit form in.
-
-          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.
-          </description>
-        </attribute>
-
-      <attribute name="title" required="no">
-        <description>
-          The browser menu label for the edit form
-
-          This attribute defaults to "Edit".
-          </description>
-        </attribute>
-
-      </directive>
-
-    <directive
-       name="subeditform"
-       attributes="name schema label for layer permission class template
-                   fulledit fulledit_label"
-       handler="zope.app.browser.form.editview.subedit"
-       />
-
-    <directive
-       name="addform"
-       handler="zope.app.browser.form.add.add"
-       attributes="menu title"
-       >
-      <description>
-        Define an automatically generated add form
-
-        The addform 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 addform directive provides an
-        customization interface to overcome this difficulty.
-
-        See zope.app.interfaces.browser.form.IAddFormCustomization.
-      </description>
-
-      <attribute name="name" required="yes">
-        <description>
-        The name of the generated add view.
-        </description>
-        </attribute>
-
-      <attribute name="schema" required="yes">
-        <description>
-        The schema from which the add form is generated.
-
-        A schema is an interface that includes fields.
-        </description>
-        </attribute>
-
-      <attribute name="label" required="no">
-        <description>
-        A label to be used as the heading for the form.
-        </description>
-        </attribute>
-
-      <attribute name="description" required="no">
-        <description>
-         A longer description of the add form.
-
-          A UI may display this with the item or display it when the
-          user requests more assistance.
-        </description>
-        </attribute>
-
-      <attribute name="for" required="no">
-        <description>
-        The interface this page (view) applies to.
-
-        The view will be for all objects that implement this interface.
-
-        zope.app.interfaces.container.IAdding is used if this
-        attribute isn't specified.  If this attribute is specified,
-        then either the named interface must extend IAdding or a class
-        attribute must be used to supply a class implements certain
-        methods described in
-        zope.app.interfaces.browser.form.IAddFormCustomization.
-
-        The schema is used if the for attribute is not specified.
-
-        If the for attribute is specified, then the objects views must
-        implement or be adaptable to the schema.
-        </description>
-        </attribute>
-
-      <attribute name="fields" required="no">
-        <description>
-        The fields and the order in which to display them.  If this
-        is not specified, all schema fields will be displayed in the
-        order specified in the schema itself.
-        </description>
-      </attribute>
-
-      <attribute name="layer" required="no">
-        <description>
-              The layer the view is in.
-
-              A skin is composed of layers. It is common to put skin specific
-              views in a layer named after the skin. If the 'layer' attribute
-              is not supplied, it defaults to 'default'.
-          </description>
-        </attribute>
-
-
-       <attribute name="permission" required="yes">
-        <description>
-              The permission needed to use the view. 
-          </description>
-        </attribute>
-
-      <attribute name="template" required="no">
-        <description>
-        An alternate template to use for the add form.
-
-        XXX Need to document how to extend the default.
-        </description>
-        </attribute>
-
-      <attribute name="class" required="no">
-        <description>
-        A class to provide custom widget definitions or methods to be
-        used by a custom template.
-
-        This class can override methods defined in IAddFormCustomization.
-
-        This class is used as a mix-in class. As a result, it needn't
-        subclass any special classes, such as BrowserView.
-        </description>
-        </attribute>
-
-
-      <attribute name="content_factory" required="no">
-        <description>
-          The dotted name of an object to call to create new content objects.
-
-          This attribute isn't used if a class is specified that
-          implements createAndAdd.
-          </description>
-        </attribute>
-
-      <attribute name="arguments" required="no">
-        <description>
-          A list of field names to supply as positional arguments to
-          the factory.
-        </description>
-      </attribute>
-
-      <attribute name="keyword_arguments" required="no">
-        <description>
-          A list of field names to supply as keyword arguments to
-          the factory.
-        </description>
-      </attribute>
-
-      <attribute name="set_before_add" required="no">
-        <description>
-          A list of fields to be assigned to the newly created object
-          before it is added.
-        </description>
-      </attribute>
-
-      <attribute name="set_after_add" required="no">
-        <description>
-          A list of fields to be assigned to the newly created object
-          after it is added.
-        </description>
-      </attribute>
-
-      <attribute name="menu" required="no">
-        <description>
-          The browser menu to include the add form in.
-
-          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.
-          </description>
-        </attribute>
-
-      </directive>
-
-    <directive name="schemadisplay" handler=".schemadisplay.display">
-
-      <description>
-        Define an automatically generated display form.
-
-        The schemadisplay directive creates and register's a view for
-        displaying an object based on a schema.
-      </description>
-
-      <attribute name="name" required="yes">
-        <description>
-        The name of the generated display view.
-        </description>
-        </attribute>
-
-      <attribute name="schema" required="yes">
-        <description>
-        The schema from which the display form is generated.
-
-        A schema is an interface that includes fields.
-        </description>
-        </attribute>
-
-      <attribute name="label" required="no">
-        <description>
-        A label to be used as the heading for the form.
-        </description>
-        </attribute>
-
-      <attribute name="for" required="no">
-        <description>
-        The interface this page (view) applies to. 
-
-        The view will be for all objects that implement this interface.
-
-        The schema is used if the for attribute is not specified.
-
-        If the for attribute is specified, then the objects views must
-        implement or be adaptable to the schema.
-        </description>
-        </attribute>
-
-      <attribute name="fields" required="no">
-        <description>
-        The fields and the order in which to display them.  If this
-        is not specified, all schema fields will be displayed in the
-        order specified in the schema itself.
-        </description>
-      </attribute>
-
-      <attribute name="layer" required="no">
-        <description>
-        The layer the view is in. 
-
-        A skin is composed of layers. It is common to put skin specific
-        views in a layer named after the skin. If the 'layer' attribute
-        is not supplied, it defaults to 'default'. 
-        </description>
-        </attribute>
-
-      <attribute name="permission" required="yes">
-        <description>
-        The permission needed to use the view. 
-        </description>
-        </attribute>
-
-      <attribute name="template" required="no">
-        <description>
-        An alternate template to use for the display form.
-
-        XXX Need to document how to extend the default.
-        </description>
-        </attribute>
-
-      <attribute name="class" required="no">
-        <description>
-        A class to provide custom widget definitions or methods to be
-        used by a custom template.
-
-        This class is used as a mix-in class. As a result, it needn't
-        subclass any special classes, such as BrowserView.
-        </description>
-        </attribute>
-
-      <attribute name="menu" required="no">
-        <description>
-        The browser menu to include the display form in.
-
-        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.
-        </description>
-        </attribute>
-
-      <attribute name="title" required="no">
-        <description>
-        The browser menu label for the display form
-
-        This attribute defaults to "Display".
-        </description>
-        </attribute>
-
-      </directive>
-
-  </directives>
-
-</zopeConfigure>
+</configure>


=== Zope3/src/zope/app/browser/form/schemadisplay.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/browser/form/schemadisplay.py:1.5	Thu Jun  5 16:13:07 2003
+++ Zope3/src/zope/app/browser/form/schemadisplay.py	Sat Aug  2 03:03:55 2003
@@ -19,7 +19,6 @@
 
 from zope.schema import getFieldNamesInOrder
 
-from zope.configuration.action import Action
 from zope.app.context import ContextWrapper
 from zope.publisher.interfaces.browser import IBrowserPresentation
 from zope.publisher.browser import BrowserView
@@ -34,9 +33,7 @@
 from zope.app.publisher.browser.globalbrowsermenuservice \
      import menuItemDirective, globalBrowserMenuService
 
-# XXX perhaps a little too intimate?
-from zope.app.browser.form.editview import normalize
-
+from editview import normalize
 
 class DisplayView(BrowserView):
     """Simple display-view base class.
@@ -95,25 +92,21 @@
                                permission))
     provideView(for_, name, IBrowserPresentation, class_, layer)
 
-
 def display(_context, name, schema, permission, label='',
-            layer="default",
-            class_=None, for_=None,
-            template=None, omit=None, fields=None,
+            layer="default", class_=None, for_=None,
+            template=None, fields=None,
             menu=None, title='Display', usage=u''):
-    actions = []
     if menu:
         actions = menuItemDirective(
             _context, menu, for_ or schema, '@@' + name, title,
             permission=permission)
 
-    schema, for_, bases, template, fields = normalize(
-        _context, schema, for_, class_, template, 'display.pt', fields, omit,
-        DisplayView)
+    for_, bases, template, fields = normalize(
+        for_, schema, class_, template, 'display.pt', fields, DisplayView)
 
-    actions.append(Action(
+    _context.action(
         discriminator=('view', for_, name, IBrowserPresentation, layer),
         callable=DisplayViewFactory,
         args=(name, schema, label, permission, layer, template, 'display.pt',
-              bases, for_, fields, menu, usage)))
-    return actions
+              bases, for_, fields, menu, usage)
+        )