[Zope3-checkins] CVS: Zope3/src/zope/app/site/browser -
meta.zcml:1.1 metaconfigure.py:1.1 metadirectives.py:1.1
Stephan Richter
srichter at cosmos.phy.tufts.edu
Sun Mar 21 11:02:18 EST 2004
Update of /cvs-repository/Zope3/src/zope/app/site/browser
In directory cvs.zope.org:/tmp/cvs-serv2802/src/zope/app/site/browser
Added Files:
meta.zcml metaconfigure.py metadirectives.py
Log Message:
Added browser:tool directive.
=== Added File Zope3/src/zope/app/site/browser/meta.zcml ===
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:meta="http://namespaces.zope.org/meta">
<meta:directive
namespace="http://namespaces.zope.org/browser"
name="tool"
schema=".metadirectives.IUtilityToolDirective"
handler=".metaconfigure.tool"/>
</configure>
=== Added File Zope3/src/zope/app/site/browser/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.
#
##############################################################################
"""Configuration handlers for 'tools' directive.
$Id: metaconfigure.py,v 1.1 2004/03/21 16:02:18 srichter Exp $
"""
from zope.publisher.interfaces.browser import IBrowserRequest, IBrowserPublisher
from zope.app.component.metaconfigure import view, interface as ifaceDirective
from zope.app.site.interfaces import ISiteManager
from tools import UtilityToolsViewFactory, IUtilityToolsView, IToolType
def tool(_context, interface, folder="tools", title=None, description=None):
factory = UtilityToolsViewFactory(interface, folder, title, description)
name = "manage" + interface.getName() + "Tool.html"
permission = 'zope.ManageContent'
ifaceDirective(_context, interface, IToolType)
view(_context, [factory], IBrowserRequest, name, [ISiteManager],
permission=permission,
allowed_interface=[IUtilityToolsView, IBrowserPublisher],
allowed_attributes=['__call__', '__getitem__'])
=== Added File Zope3/src/zope/app/site/browser/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.
#
##############################################################################
"""'tool' directive for 'browser' namespace
$Id: metadirectives.py,v 1.1 2004/03/21 16:02:18 srichter Exp $
"""
from zope.configuration.fields import GlobalObject, PythonIdentifier, MessageID
from zope.interface import Interface
class IUtilityToolDirective(Interface):
"""Directive for creating new utility-based tools."""
interface = GlobalObject(
title=u"Interface",
description=u"Interface used to filter out the available entries in a \
tool",
required=True)
folder = PythonIdentifier(
title=u"Destination Folder",
description=u"""Destination Folder in which the tool instances are
placed.""",
required=False,
default=u"tools")
title = MessageID(
title=u"Title",
description=u"""The title of the tool.""",
required=False
)
description = MessageID(
title=u"Description",
description=u"Narrative description of what the tool represents.",
required=False
)
More information about the Zope3-Checkins
mailing list