[Zope3-checkins] CVS: Zope3/src/zope/app/zapi - __init__.py:1.1
interfaces.py:1.1
Stephan Richter
srichter at cosmos.phy.tufts.edu
Mon Mar 15 07:03:47 EST 2004
Update of /cvs-repository/Zope3/src/zope/app/zapi
In directory cvs.zope.org:/tmp/cvs-serv32711/src/zope/app/zapi
Added Files:
__init__.py interfaces.py
Log Message:
Made zapi a package and moved its interface there.
=== Added File Zope3/src/zope/app/zapi/__init__.py ===
##############################################################################
#
# Copyright (c) 2003 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.
#
##############################################################################
"""Collection of many common api functions
Makes imports easier
$Id: __init__.py,v 1.1 2004/03/15 12:03:45 srichter Exp $
"""
from interfaces import IZAPI
from zope.interface import moduleProvides
from zope.app import servicenames
moduleProvides(IZAPI)
__all__ = tuple(IZAPI)
from zope.component import *
from zope.app.traversing import *
from zope.app.exception.interfaces import UserError
name = getName
=== Added File Zope3/src/zope/app/zapi/interfaces.py ===
##############################################################################
#
# Copyright (c) 2003 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.
#
##############################################################################
"""Interface definition for the Zope convenience API module
$Id: interfaces.py,v 1.1 2004/03/15 12:03:45 srichter Exp $
"""
from zope.interface import Attribute
from zope.component.interfaces import IComponentArchitecture
from zope.app.traversing.interfaces import ITraversalAPI
class IZAPI(
IComponentArchitecture,
ITraversalAPI,
):
"""Convenience API for use with Zope applications.
"""
def name(obj):
"""Return an object's name
This is the name the object is stored under in the container
it was accessed in. If the name is unknown, None is returned.
"""
def UserError(*args):
"""Return an error message to a user.
The error is an exception to be raised.
The given args will be converted to strings and displayed in
the message shown the user.
"""
def add(container, name, object):
"""Add an object to a container
This helper function takes care of getting an adapter that
publishes necessary errors and calling necessary hooks.
"""
def remove(container, name):
"""Remove an object from a container
This helper function takes care of getting an adapter that
publishes necessary errors and calling necessary hooks.
"""
servicenames = Attribute("Service Names")
More information about the Zope3-Checkins
mailing list