[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form -
metaconfigure.py:1.1 add.py:1.28 addwizard.py:1.8
editview.py:1.33 editwizard.py:1.11 meta.zcml:1.21
schemadisplay.py:1.9
Philipp von Weitershausen
philikon at philikon.de
Mon Aug 4 11:53:23 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app/browser/form
In directory cvs.zope.org:/tmp/cvs-serv18707
Modified Files:
add.py addwizard.py editview.py editwizard.py meta.zcml
schemadisplay.py
Added Files:
metaconfigure.py
Log Message:
Refactored ZCML directive handlers for zope.app.browser.form. Since they
share a lot of funcationality, it only made sense to bundle this in one
way or another.
I've chosen to put this into base classes and let the handlers be classes
subclassing them. While clarity is somewhat subjective to each person, this
refactoring definitely makes it more extensible.
=== Added File Zope3/src/zope/app/browser/form/metaconfigure.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: metaconfigure.py,v 1.1 2003/08/04 14:52:45 philikon Exp $
"""
__metaclass__ = type
import os
from zope.configuration.exceptions import ConfigurationError
from zope.schema import getFieldNamesInOrder
from zope.app.interfaces.container import IAdding
from zope.publisher.interfaces.browser import IBrowserPresentation
from zope.app.publisher.browser.globalbrowsermenuservice import \
menuItemDirective
from add import AddView, AddViewFactory
from editview import EditView, EditViewFactory
from addwizard import AddWizardView, AddWizardViewFactory
from editwizard import EditWizardView, EditWizardViewFactory
from schemadisplay import DisplayView, DisplayViewFactory
class BaseFormDirective:
# to be overriden by the subclasses
view = None
default_template = None
# default basic information
for_ = None
layer = 'default'
permission = 'zope.Public'
template = None
class_ = None
title = None
label = None
# default form information
title = None
label = None
menu = None
fields = None
def __init__(self, _context, **kwargs):
self._context = _context
for key, value in kwargs.items():
if not(value is None and hasattr(self, key)):
setattr(self, key, value)
self._normalize()
def _normalize(self):
if self.for_ is None:
self.for_ = self.schema
if self.class_ is None:
self.bases = (self.view,)
else:
self.bases = (self.class_, self.view)
if self.template is not None:
self.template = os.path.abspath(str(self.template))
if not os.path.isfile(self.template):
raise ConfigurationError("No such file", template)
else:
self.template = self.default_template
self.names = getFieldNamesInOrder(self.schema)
if self.fields:
for name in self.fields:
if name not in self.names:
raise ValueError("Field name is not in schema",
name, self.schema)
else:
self.fields = self.names
def _args(self):
return (self.name, self.schema, self.label, self.permission,
self.layer, self.template, self.default_template,
self.bases, self.for_, self.fields)
def _discriminator(self):
return ('view', self.for_, self.name, IBrowserPresentation,
self.layer)
class BaseWizardDirective(BaseFormDirective):
# default wizard information
description = None
use_sessions = True
def __init__(self, _context, **kwargs):
super(AddWizardDirective, self).__init__(_context, **kwargs)
self.panes = []
def _args(self):
return (self.name, self.schema, self.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',
name, self.schema
)
self.panes.append(Pane(fields, label))
class AddFormDirective(BaseFormDirective):
view = AddView
default_template = 'add.pt'
for_ = IAdding
# default add form information
description = None
content_factory = None
arguments = None
keyword_arguments = None
set_before_add = None
set_after_add = None
def _handle_menu(self):
if self.menu or self.title:
if (not self.menu) or (not self.title):
raise ValueError("If either menu or title are specified, "
"they must both be specified")
menuItemDirective(
self._context, self.menu, self.for_, '@@' + self.name,
self.title, permission=self.permission,
description=self.description)
def _handle_arguments(self, leftover=None):
schema = self.schema
fields = self.fields
arguments = self.arguments
keyword_arguments = self.keyword_arguments
set_before_add = self.set_before_add
set_after_add = self.set_after_add
if leftover is None:
leftover = fields
if arguments:
missing = [n for n in arguments if n not in fields]
if missing:
raise ValueError("Some arguments are not included in the form",
missing)
optional = [n for n in arguments if not schema[n].required]
if optional:
raise ValueError("Some arguments are optional, use"
" keyword_arguments for them",
optional)
leftover = [n for n in leftover if n not in arguments]
if keyword_arguments:
missing = [n for n in keyword_arguments if n not in fields]
if missing:
raise ValueError(
"Some keyword_arguments are not included in the form",
missing)
leftover = [n for n in leftover if n not in keyword_arguments]
if set_before_add:
missing = [n for n in set_before_add if n not in fields]
if missing:
raise ValueError(
"Some set_before_add are not included in the form",
missing)
leftover = [n for n in leftover if n not in set_before_add]
if set_after_add:
missing = [n for n in set_after_add if n not in fields]
if missing:
raise ValueError(
"Some set_after_add are not included in the form",
missing)
leftover = [n for n in leftover if n not in set_after_add]
self.set_after_add += leftover
else:
self.set_after_add = leftover
def __call__(self):
self._handle_menu()
self._handle_arguments()
self._context.action(
discriminator = self._discriminator(),
callable = AddViewFactory,
args = self._args()+(self.content_factory, self.arguments,
self.keyword_arguments,
self.set_before_add, self.set_after_add),
)
class EditFormDirective(BaseFormDirective):
view = EditView
default_template = 'edit.pt'
usage = None
title = 'Edit'
def _handle_menu(self):
if self.menu:
menuItemDirective(
self._context, self.menu, self.for_ or self.schema,
'@@' + self.name, self.title, permission=self.permission)
def __call__(self):
self._handle_menu()
self._context.action(
discriminator = self._discriminator(),
callable = EditViewFactory,
args = self._args()+(self.menu, self.usage),
)
class SubeditFormDirective(BaseFormDirective):
view = EditView
default_template = 'subedit.pt'
# default subedit form directive
fulledit = None
fulledit_label = None
def __call__(self):
self._context.action(
discriminator = self._discriminator(),
callable = EditViewFactory,
args = self._args()+(self.fulledit, self.fulledit_label),
)
class AddWizardDirective(BaseWizardDirective, AddFormDirective):
view = AddWizardView
default_template = 'addwizard.pt'
def __call__(self):
self._handle_menu()
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.usage, self.use_session)
)
class SchemaDisplayDirective(EditFormDirective):
view = DisplayView
default_template = 'display.pt'
def __call__(self):
self._handle_menu()
self._context.action(
discriminator = self._discriminator(),
callable = DisplayViewFactory,
args = self._args()+(self.menu, self.usage)
)
=== Zope3/src/zope/app/browser/form/add.py 1.27 => 1.28 ===
--- Zope3/src/zope/app/browser/form/add.py:1.27 Sat Aug 2 22:13:02 2003
+++ Zope3/src/zope/app/browser/form/add.py Mon Aug 4 10:52:45 2003
@@ -19,7 +19,6 @@
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
@@ -31,9 +30,7 @@
from zope.publisher.interfaces.browser import IBrowserPresentation
from zope.app.pagetemplate.simpleviewclass import SimpleViewClass
from zope.app.browser.form.submit import Update
-from zope.app.browser.form.editview import EditView, normalize
-from zope.app.publisher.browser.globalbrowsermenuservice \
- import menuItemDirective
+from zope.app.browser.form.editview import EditView
class AddView(EditView):
"""Simple edit-view base class.
@@ -165,75 +162,3 @@
)
provideView(for_, name, IBrowserPresentation, class_, layer)
-
-
-def add(_context, name, schema, content_factory='', label='',
- permission = 'zope.Public', layer = "default",
- 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_.
- if menu or title:
- if (not menu) or (not title):
- raise ValueError("If either menu or title are specified, "
- "they must both be specified")
- menuItemDirective(
- _context, menu, for_, '@@' + name, title,
- permission=permission, description=description)
-
- for_, bases, template, fields = normalize(
- for_, schema, class_, template, 'add.pt', fields, AddView)
-
- leftover = fields
-
- if arguments:
- missing = [n for n in arguments if n not in fields]
- if missing:
- raise ValueError("Some arguments are not included in the form",
- missing)
- optional = [n for n in arguments if not schema[n].required]
- if optional:
- raise ValueError("Some arguments are optional, use"
- " keyword_arguments for them",
- optional)
- leftover = [n for n in leftover if n not in arguments]
-
- if keyword_arguments:
- missing = [n for n in keyword_arguments if n not in fields]
- if missing:
- raise ValueError(
- "Some keyword_arguments are not included in the form",
- missing)
- leftover = [n for n in leftover if n not in keyword_arguments]
-
- if set_before_add:
- missing = [n for n in set_before_add if n not in fields]
- if missing:
- raise ValueError(
- "Some set_before_add are not included in the form",
- missing)
- leftover = [n for n in leftover if n not in set_before_add]
-
- if set_after_add:
- missing = [n for n in set_after_add if n not in fields]
- if missing:
- raise ValueError(
- "Some set_after_add are not included in the form",
- missing)
- leftover = [n for n in leftover if n not in set_after_add]
-
- set_after_add += leftover
-
- else:
- set_after_add = leftover
-
- _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),
- )
=== Zope3/src/zope/app/browser/form/addwizard.py 1.7 => 1.8 ===
--- Zope3/src/zope/app/browser/form/addwizard.py:1.7 Sat Aug 2 22:13:02 2003
+++ Zope3/src/zope/app/browser/form/addwizard.py Mon Aug 4 10:52:45 2003
@@ -16,25 +16,19 @@
"""
import sys
-import logging
-from zope.interface import implements, classProvides
from zope.schema.interfaces import ValidationError
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.app.form.utility import setUpWidgets
from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
from zope.security.checker import defineChecker, NamesChecker
from zope.component import getAdapter
from zope.component.view import provideView
from zope.publisher.interfaces.browser import IBrowserPresentation
from zope.app.pagetemplate.simpleviewclass import SimpleViewClass
-from zope.app.browser.form.submit import Update
-from zope.app.browser.form.editview import EditView, normalize
-from zope.app.publisher.browser.globalbrowsermenuservice \
- import menuItemDirective
-from editwizard import EditWizardView, Pane, WizardStorage
+from editwizard import EditWizardView, WizardStorage
class AddWizardView(EditWizardView):
"""Multi-page add-view base class.
@@ -142,130 +136,3 @@
)
provideView(for_, name, IBrowserPresentation, class_, layer)
-
-
-class AddWizardDirective:
-
- def __init__(
- self, _context, name, schema, permission, content_factory='',
- layer='default', template=None,
- for_='zope.app.interfaces.container.IAdding', class_=None,
- arguments='',keyword_arguments='', set_before_add='', set_after_add='',
- menu=None, description='', title=None, use_session='yes'
- ):
-
- self.name = name
- self.permission = permission
- self.title = title
- self.layer = layer
- self.menu = menu
- self.set_before_add = set_before_add
- self.set_after_add = set_after_add
-
- if use_session == 'yes':
- self.use_session = True
- elif use_session == 'no':
- self.use_session = False
- else:
- raise ValueError('Invalid value %r for use_session'%(use_session,))
-
- # Handle menu attrs. We do this now to rather than later becaise
- # menuItemDirective expects a dotted name for for_.
- if menu or title:
- if (not menu) or (not title):
- raise ValueError("If either menu or title are specified, "
- "they must both be specified")
- menuItemDirective(
- _context, menu, for_, '@@' + name, title,
- permission=permission, description=description)
-
- self.content_factory = content_factory
-
- 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
- self.template = template
- self.all_fields = fields
-
- self.arguments = arguments
- self.keyword_arguments = keyword_arguments
-
- self.panes = []
-
- def pane(self, _context, fields, label=''):
- for f in fields:
- if f not in self.all_fields:
- raise ValueError(
- 'Field name is not in schema',
- name, self.schema
- )
- self.panes.append(Pane(fields, label))
-
- def __call__(self):
-
- # Argument code Cut & Paste from add.py
- leftover = []
- for pane in self.panes:
- leftover.extend(pane.names)
- fields = leftover[:]
-
- arguments = self.arguments
- if arguments:
- missing = [n for n in arguments if n not in fields]
- if missing:
- raise ValueError("Some arguments are not included in the form",
- missing)
- optional = [n for n in arguments if not self.schema[n].required]
- if optional:
- raise ValueError("Some arguments are optional, use"
- " keyword_arguments for them",
- optional)
- leftover = [n for n in leftover if n not in arguments]
-
- keyword_arguments = self.keyword_arguments
- if keyword_arguments:
- missing = [n for n in keyword_arguments if n not in fields]
- if missing:
- raise ValueError(
- "Some keyword_arguments are not included in the form",
- missing)
- leftover = [n for n in leftover if n not in keyword_arguments]
-
- set_before_add = self.set_before_add
- if set_before_add:
- missing = [n for n in set_before_add if n not in fields]
- if missing:
- raise ValueError(
- "Some set_before_add are not included in the form",
- missing)
- leftover = [n for n in leftover if n not in set_before_add]
-
- set_after_add = self.set_after_add
- if set_after_add:
- missing = [n for n in set_after_add if n not in fields]
- if missing:
- raise ValueError(
- "Some set_after_add are not included in the form",
- missing)
- leftover = [n for n in leftover if n not in set_after_add]
-
- set_after_add += leftover
-
- else:
-
- set_after_add = leftover
-
- 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)
- )
=== Zope3/src/zope/app/browser/form/editview.py 1.32 => 1.33 ===
--- Zope3/src/zope/app/browser/form/editview.py:1.32 Sat Aug 2 22:13:02 2003
+++ Zope3/src/zope/app/browser/form/editview.py Mon Aug 4 10:52:45 2003
@@ -15,23 +15,16 @@
$Id$
"""
-import os
-
from datetime import datetime
-from zope.configuration.exceptions import ConfigurationError
-from zope.schema.interfaces import ValidationError
from zope.schema import getFieldNamesInOrder
-
-from zope.interface import classProvides, implements
-
-from zope.app.context import ContextWrapper
from zope.publisher.interfaces.browser import IBrowserPresentation
from zope.publisher.browser import BrowserView
from zope.security.checker import defineChecker, NamesChecker
from zope.component.view import provideView
from zope.component import getAdapter
+from zope.app.context import ContextWrapper
from zope.app.interfaces.form import WidgetsError
from zope.app.form.utility import setUpEditWidgets, applyWidgetsChanges
from zope.app.browser.form.submit import Update
@@ -40,9 +33,6 @@
from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
from zope.app.pagetemplate.simpleviewclass import SimpleViewClass
-from zope.app.publisher.browser.globalbrowsermenuservice \
- import menuItemDirective, globalBrowserMenuService
-
class EditView(BrowserView):
"""Simple edit-view base class
@@ -139,70 +129,3 @@
permission))
provideView(for_, name, IBrowserPresentation, class_, layer)
-
-
-def normalize(for_, schema, class_, template, default_template, fields, view=EditView):
- if for_ is None:
- for_ = schema
-
- if class_ is None:
- bases = view,
- else:
- bases = (class_, view)
-
- if template is not None:
- 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:
- for name in fields:
- if name not in names:
- raise ValueError("Field name is not in schema",
- name, schema)
- else:
- fields = names
-
- return (for_, bases, template, fields)
-
-def edit(_context, name, schema, permission, label='',
- layer = "default", class_ = None, for_ = None,
- template = None, fields=None,
- menu=None, title='Edit', usage=u''):
-
- if menu:
- menuItemDirective(
- _context, menu, for_ or schema, '@@' + name, title,
- permission=permission)
-
- for_, bases, template, fields = normalize(
- for_, schema, class_, template, 'edit.pt', fields)
-
- _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),
- )
-
-def subedit(_context, name, schema, label,
- permission='zope.Public', layer="default",
- class_=None, for_=None, template=None, fields=None,
- fulledit=None, fulledit_label=None):
-
- for_, bases, template, fields = normalize(
- for_, schema, class_, template, 'subedit.pt', fields)
-
- _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.10 => 1.11 ===
--- Zope3/src/zope/app/browser/form/editwizard.py:1.10 Sat Aug 2 22:13:02 2003
+++ Zope3/src/zope/app/browser/form/editwizard.py Mon Aug 4 10:52:45 2003
@@ -15,28 +15,25 @@
$Id$
"""
-import logging
-from UserDict import UserDict
-from zope.interface import implements, classProvides
from zope.publisher.interfaces.browser import IBrowserPresentation
from zope.component import getAdapter
-from zope.app.publisher.browser.globalbrowsermenuservice \
- import menuItemDirective, globalBrowserMenuService
+from zope.app.publisher.browser.globalbrowsermenuservice import \
+ globalBrowserMenuService
from zope.app.pagetemplate.simpleviewclass import SimpleViewClass
from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
-from editview import normalize, EditViewFactory, EditView
from zope.security.checker import defineChecker, NamesChecker
from zope.app.context import ContextWrapper
from zope.component.view import provideView
from zope.app.form.utility \
import setUpEditWidgets, getWidgetsData, applyWidgetsChanges
from zope.app.interfaces.form import WidgetInputError
-from submit import Next, Previous, Update
from zope.app.interfaces.form import WidgetsError
-from zope.i18n import MessageIDFactory
from zope.app.event import publish
from zope.app.event.objectevent import ObjectModifiedEvent
+from editview import EditView
+from submit import Next, Previous, Update
+
PaneNumber = 'CURRENT_PANE_IDX'
# TODO: Needs to be persistent aware for session (?)
@@ -220,65 +217,6 @@
def __init__(self, field_names, label):
self.names = field_names
self.label = label
-
-
-class EditWizardDirective:
-
- def __init__(self, _context, name, schema, permission,
- for_=None, class_=None, template=None, layer='default',
- menu=None, title='Edit', use_session='yes'):
- self.name = name
- self.permission = permission
- self.title = title
- self.layer = layer
- self.menu = menu
-
- if use_session.lower() == 'yes':
- self.use_session = True
- elif use_session.lower() == 'no':
- self.use_session = False
- else:
- raise ValueError('Invalid value %r for use_session'%(use_session,))
-
- if menu:
- actions = menuItemDirective(
- _context, menu, for_ or schema, '@@' + name, title,
- permission=permission
- )
- else:
- actions = []
-
- 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
- self.template = template
- self.all_fields = fields
-
- self.panes = []
- self.actions = actions
-
- def pane(self, _context, fields, label=''):
- for f in fields:
- if f not in self.all_fields:
- raise ValueError(
- 'Field name is not in schema',
- name, self.schema
- )
- self.panes.append(Pane(fields, label))
-
- def __call__(self):
- 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)
- )
def EditWizardViewFactory(name, schema, permission, layer,
panes, fields, template, default_template, bases, for_,
=== Zope3/src/zope/app/browser/form/meta.zcml 1.20 => 1.21 ===
--- Zope3/src/zope/app/browser/form/meta.zcml:1.20 Sat Aug 2 22:13:02 2003
+++ Zope3/src/zope/app/browser/form/meta.zcml Mon Aug 4 10:52:45 2003
@@ -8,7 +8,7 @@
<meta:complexDirective
name="addwizard"
schema=".metadirectives.IAddWizardDirective"
- handler="zope.app.browser.form.addwizard.AddWizardDirective"
+ handler=".metaconfigure.AddWizardDirective"
>
<meta:subdirective
@@ -21,7 +21,7 @@
<meta:complexDirective
name="editwizard"
schema=".metadirectives.IEditWizardDirective"
- handler="zope.app.browser.form.editwizard.EditWizardDirective"
+ handler=".metaconfigure.EditWizardDirective"
>
<meta:subdirective
@@ -31,28 +31,28 @@
</meta:complexDirective>
- <meta:directive
+ <meta:complexDirective
name="editform"
schema=".metadirectives.IEditFormDirective"
- handler=".editview.edit"
+ handler=".metaconfigure.EditFormDirective"
/>
- <meta:directive
+ <meta:complexDirective
name="subeditform"
schema=".metadirectives.ISubeditFormDirective"
- handler=".editview.subedit"
+ handler=".metaconfigure.SubeditFormDirective"
/>
- <meta:directive
+ <meta:complexDirective
name="addform"
schema=".metadirectives.IAddFormDirective"
- handler=".add.add"
+ handler=".metaconfigure.AddFormDirective"
/>
- <meta:directive
+ <meta:complexDirective
name="schemadisplay"
schema=".metadirectives.ISchemaDisplayDirective"
- handler=".schemadisplay.display"
+ handler=".metaconfigure.SchemaDisplayDirective"
/>
</meta:directives>
=== Zope3/src/zope/app/browser/form/schemadisplay.py 1.8 => 1.9 ===
--- Zope3/src/zope/app/browser/form/schemadisplay.py:1.8 Sat Aug 2 22:13:02 2003
+++ Zope3/src/zope/app/browser/form/schemadisplay.py Mon Aug 4 10:52:45 2003
@@ -30,11 +30,6 @@
from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
from zope.app.pagetemplate.simpleviewclass import SimpleViewClass
-from zope.app.publisher.browser.globalbrowsermenuservice \
- import menuItemDirective, globalBrowserMenuService
-
-from editview import normalize
-
class DisplayView(BrowserView):
"""Simple display-view base class.
@@ -91,22 +86,3 @@
NamesChecker(("__call__", "__getitem__", "browserDefault"),
permission))
provideView(for_, name, IBrowserPresentation, class_, layer)
-
-def display(_context, name, schema, permission, label='',
- layer="default", class_=None, for_=None,
- template=None, fields=None,
- menu=None, title='Display', usage=u''):
- if menu:
- actions = menuItemDirective(
- _context, menu, for_ or schema, '@@' + name, title,
- permission=permission)
-
- for_, bases, template, fields = normalize(
- for_, schema, class_, template, 'display.pt', fields, DisplayView)
-
- _context.action(
- discriminator=('view', for_, name, IBrowserPresentation, layer),
- callable=DisplayViewFactory,
- args=(name, schema, label, permission, layer, template, 'display.pt',
- bases, for_, fields, menu, usage)
- )
More information about the Zope3-Checkins
mailing list