[Zope3-checkins] CVS: Zope3/src/zope/app/interfaces/services - __init__.py:1.1.2.1 auth.py:1.1.2.1 cache.py:1.1.2.1 configuration.py:1.1.2.1 configurationmanager.py:1.1.2.1 connection.py:1.1.2.1 error.py:1.1.2.1 event.py:1.1.2.1 hub.py:1.1.2.1 interfaces.py:1.1.2.1 package.py:1.1.2.1 principalannotation.py:1.1.2.1 query.py:1.1.2.1 service.py:1.1.2.1 session.py:1.1.2.1
Jim Fulton
jim@zope.com
Mon, 23 Dec 2002 14:31:55 -0500
Update of /cvs-repository/Zope3/src/zope/app/interfaces/services
In directory cvs.zope.org:/tmp/cvs-serv19908/zope/app/interfaces/services
Added Files:
Tag: NameGeddon-branch
__init__.py auth.py cache.py configuration.py
configurationmanager.py connection.py error.py event.py hub.py
interfaces.py package.py principalannotation.py query.py
service.py session.py
Log Message:
Initial renaming before debugging
=== Added File Zope3/src/zope/app/interfaces/services/__init__.py ===
#
# This file is necessary to make this directory a package.
=== Added File Zope3/src/zope/app/interfaces/services/auth.py ===
##############################################################################
#
# Copyright (c) 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: auth.py,v 1.1.2.1 2002/12/23 19:31:53 jim Exp $
"""
from zope.interface import Interface
from zope.app.interfaces.security import IPrincipal
class IReadUser(IPrincipal):
"""Read interface for a User."""
def getLogin():
"""Get the login for the user."""
def getRoles():
"""Get the roles for the user."""
def validate(pw):
"""Seee whether the password is valid."""
class IWriteUser(Interface):
"""Write interface for a User."""
def setTitle(title):
"""Set title of User."""
def setDescription(description):
"""Set description of User."""
def setLogin(login):
"""Set login of User."""
def setRoles(roles):
"""Set roles of User."""
def setPassword(password):
"""Set password of User."""
class IUser(IReadUser, IWriteUser):
"""A user object for the Local Authentication Service."""
=== Added File Zope3/src/zope/app/interfaces/services/cache.py ===
##############################################################################
#
# Copyright (c) 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.
#
##############################################################################
"""A configuration for a cache.
$Id: cache.py,v 1.1.2.1 2002/12/23 19:31:53 jim Exp $
"""
from zope.app.interfaces.services.configuration \
import INamedComponentConfiguration
class ICacheConfiguration(INamedComponentConfiguration):
"""Cache configuration
Cache configurations are dependent on the caches that they configure. They
register themselves as component dependents.
"""
=== Added File Zope3/src/zope/app/interfaces/services/configuration.py ===
##############################################################################
#
# Copyright (c) 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.
#
##############################################################################
"""Interfaces for objects supporting configuration registration
$Id: configuration.py,v 1.1.2.1 2002/12/23 19:31:53 jim Exp $
"""
from zope.interface import Interface
from zope.interface.element import Attribute
from zope.schema import Text, TextLine
from zope.schema.interfaces import ITextLine
from zope.app.security.permissionfield import PermissionField
Unregistered = u'Unregistered'
Registered = u'Registered'
Active = u'Active'
class IConfigurationStatus(ITextLine):
"""The registration status of a configuration
"""
class ConfigurationStatus(TextLine):
__implements__ = IConfigurationStatus
allowed_values = Unregistered, Registered, Active
class IConfigurationSummary(Interface):
"""Configuration summary data
"""
title = TextLine(title = u"Title",
description = u"Descriptive title",
required = True)
status = ConfigurationStatus(title = u"Configuration status")
class IConfiguration(IConfigurationSummary):
"""Configuration object
A configuration object represents a specific configuration
decision, such as registering an adapter or defining a permission.
In addition to the attributes or methods defined here,
configuration objects will include additional attributes
identifying how they should be used. For example, a service
configuration will provide a service type. An adapter
configuration will specify a used-for interface and a provided
interface.
"""
description = Text(title=u"Description",
description=u"Detailed description",
)
def activated():
"""Method called when a configuration is made active
"""
def deactivated():
"""Method called when a configuration is made inactive
"""
class INamedConfigurationInfo(Interface):
"""Configuration object that is registered by name
"""
name = TextLine(title=u"Name",
description=u"The name that is registered")
# The label is generally set as a class attribute on the
# configuration class.
label = Attribute("Descriptive label of the configuration type "
"(for example, Service, Connection)")
class INamedConfiguration(INamedConfigurationInfo, IConfiguration):
pass
class INamedComponentConfigurationInfo(INamedConfigurationInfo):
"""Configuration object that configures a component associated with a name
"""
permission = PermissionField(
title=u"The permission needed to use the component.")
componentPath = Attribute("The physical path to the component")
class INamedComponentConfiguration(INamedComponentConfigurationInfo,
INamedConfiguration):
def getComponent():
"""Return the component named in the configuration.
"""
class IConfigurationRegistry(Interface):
"""A registry of configurations for a set of parameters
A service will have a registry containing configuration registries
for specific parameters. For example, an adapter service will have
a configuration registry for each given used-for and provided
interface.
"""
def register(configuration):
"""Register the given configuration
Do nothing if the configuration is already registered.
"""
def unregister(configuration):
"""Unregister the given configuration
Do nothing if the configuration is not registered.
"""
def registered(configuration):
"""Is the configuration registered
Return a boolean indicating whether the configuration has been
registered.
"""
def activate(configuration):
"""Make the configuration active.
The activated method is called on the configuration.
Raises a ValueError if the given configuration is not registered.
"""
def deactivate(configuration):
"""Make the configuration inactive.
Id the configuration is active, the deactivated method is called
on the configuration.
Raises a ValueError if the given configuration is not registered.
The call has no effect if the configuration is registered but
not active.
"""
def active():
"""Return the active configuration, if any
Otherwise, returns None.
"""
def info():
"""Return a sequence of configuration information
The sequence items are mapping objects with keys:
id -- A string that can be used to uniquely identify the
configuration
active -- A boolean indicating whether the configuration is
active
configuration -- The configuration object.
"""
def __nonzero__(self):
"""The registry is true if it is non-empty
"""
class IConfigurable(Interface):
"""A component that can be configured using a configuration manager."""
def queryConfigurationsFor(configuration, default=None):
"""Return an IConfigurationRegistry for the configuration
Data on the configuration is used to decide which registry to
return. For example, a service manager will use the
configuration name attribute to decide which registry
to return.
Typically, an object that implements this method will also
implement a method named queryConfigurations, which takes
arguments for each of the parameters needed to specify a set
of configurations.
The registry must be returned in the context of the context of
the configurable.
"""
def createConfigurationsFor(configuration):
"""Create and return an IConfigurationRegistry for the configuration
Data on the configuration is used to decide which regsitry to
create. For example, a service manager will use the
configuration name attribute to decide which regsitry
to create.
Typically, an object that implements this method will also
implement a method named createConfigurations, which takes
arguments for each of the parameters needed to specify a set
of configurations.
Calling createConfigurationsFor twice for the same configuration
returns the same registry.
"""
class INameConfigurable(IConfigurable):
"""An IConfigurable, where a name is used to decide which registry to
return for methods in IConfigurable.
All configurations that pass through queryConfigurationsFor and
createConfigurationsFor are expected to implement INamedConfiguration.
"""
def queryConfigurations(name, default=None):
"""Return an IConfigurationRegistry for the configuration name
queryConfigurationsFor(cfg, default) is equivalent to
queryConfigurations(cfg.name, default)
"""
def createConfigurationsFor(configuration):
"""Create and return an IConfigurationRegistry for the configuration
name
createConfigurationsFor(cfg, default) is equivalent to
createConfigurations(cfg.name, default)
"""
def listConfigurationNames():
"""Return a list of all registered configuration names
"""
class INameComponentConfigurable(INameConfigurable):
"""An INameConfigurable where the configurations refer to components.
All configurations that pass through queryConfigurationsFor and
createConfigurationsFor are expected to implement
INamedComponentConfiguration.
"""
def queryActiveComponent(name, default=None):
"""Finds the configuration registry for a given name, checks if it has
an active configuration, and if so, returns its component. Otherwise
returns default.
"""
=== Added File Zope3/src/zope/app/interfaces/services/configurationmanager.py ===
##############################################################################
#
# Copyright (c) 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: configurationmanager.py,v 1.1.2.1 2002/12/23 19:31:53 jim Exp $
"""
from zope.app.interfaces.container import IContainerNamesContainer
from zope.interface import Interface
class IOrderedContainer(Interface):
"""Container with items that can be rearranged.
"""
# Yes, maybe this should be in the container package, but, we are
# likely to come up with a better general ordering interface, so
# we'll leave this one here for now.
def moveTop(names):
"""Move the objects corresponding to the given names to the top
"""
def moveUp(names):
"""Move the objects corresponding to the given names up
"""
def moveBottom(names):
"""Move the objects corresponding to the given names to the bottom
"""
def moveDown(names):
"""Move the objects corresponding to the given names down
"""
class IConfigurationManager(IContainerNamesContainer, IOrderedContainer):
"""Manage Configurations
"""
__doc__ = IConfigurationManager.__doc__ + __doc__
=== Added File Zope3/src/zope/app/interfaces/services/connection.py ===
##############################################################################
#
# Copyright (c) 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.
#
##############################################################################
"""A configuration for a database adapter.
$Id: connection.py,v 1.1.2.1 2002/12/23 19:31:53 jim Exp $
"""
from zope.app.interfaces.services.configuration \
import INamedComponentConfiguration
class IConnectionConfiguration(INamedComponentConfiguration):
"""Database Connection Configuration
Connection configurations are dependent on the database adapters that they
configure. They register themselves as component dependents.
"""
=== Added File Zope3/src/zope/app/interfaces/services/error.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.
#
##############################################################################
"""
Revision information:
$Id: error.py,v 1.1.2.1 2002/12/23 19:31:53 jim Exp $
"""
from zope.interface import Interface
class IErrorReportingService(Interface):
"""Error Reporting Service Interface.
"""
def raising(info, request=None):
"""Logs an exception.
"""
def getProperties():
"""Gets the properties as dictionary.
keep_entries, copy_to_logfile, ignored_exceptions
"""
def setProperties(keep_entries, copy_to_zlog=0, ignored_exceptions=(),
RESPONSE=None):
"""Sets the properties. keep_entries, copy_to_logfile,
ignored_exceptions
"""
def getLogEntries():
"""Returns the entries in the log, most recent first.
"""
def getLogEntryById(id):
"""Return LogEntry by ID
"""
=== Added File Zope3/src/zope/app/interfaces/services/event.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.
#
##############################################################################
"""
Revision information:
$Id: event.py,v 1.1.2.1 2002/12/23 19:31:53 jim Exp $
"""
from zope.interface.element import Attribute
from zope.interfaces.event import IIndirectSubscriber
class IPathSubscriber(IIndirectSubscriber):
def __init__(wrapped_subscriber):
"""creates new PathSubscriber for the given wrapped_subscriber"""
subscriber_path = Attribute(
"""the slash-delineated physical path to the subscriber"""
)
=== Added File Zope3/src/zope/app/interfaces/services/hub.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.
#
##############################################################################
"""
Revision information:
$Id: hub.py,v 1.1.2.1 2002/12/23 19:31:53 jim Exp $
"""
class ObjectHubError(Exception):
pass
class IObjectHub(IHubEventChannel):
"""ObjectHub.
Receives Object Modify Events from the Event Service, and
changes these into Hub Id Object Modify Events, then passes
these on to its subscribers.
To map Object Modify Events onto Hub Id Object Modify Events, take
the location from the Object Modify Event, look up the Hub Id for this
location, and create an equivalent Hub Id Object Modify Event using this
Hub Id.
Note that we are concerned with locations and not with Objects.
An object may have more than one location. That doesn't concern
us here.
We're only interested in what happens during the time during which
an object is registered with the hub -- between ObjectRegistered
and ObjectUnregistered events. As one consequence of that, we do
care about object removals, but not (directly) about object
additions.
Table of decisions about maintaining the location<->Hub Id lookup:
Register
if location already in lookup:
raise ObjectHubError, as this is implies bad state somewhere
generate new hub id
place hub id<->location into lookup, to say that we have an
interesting object
send out hub id object register event to subscribers
Unregister
if location not in lookup:
raise ObjectHubError, as this is implies bad state somewhere
remove location<->hub id from lookup
send out hub id unregister event to subscribers
Modify
if location not in lookup:
ignore this event, as we're not interested in this object
else:
look up hub id for the location
send out hub id object modify event to subscribers
Move
if old_location not in lookup:
ignore this event, as we're not interested in this object
elif new_location is in lookup:
raise ObjectHubError
else:
look up hub id for old_location
change lookup:
remove hub id<->old_location
add hub id<->new_location
send out hub id object context-change event to subscribers
Remove (specializes Unregister)
if old_location not in lookup:
ignore this event, as we're not interested in this object
else:
look up hub id for old_location
change lookup:
remove hub id<->old_location
send out hub id object remove event to subscribers
"""
def getHubId(obj_or_loc):
"""Returns the hub id int that is mapped to the given location
or wrapped object.
Location is either a unicode, or a tuple of unicodes, or an
ascii string, or a tuple of ascii strings.
(See Zope/App/Traversing/__init__.py)
It must be absolute, so if it is a string it must start with a u'/',
and if it is a tuple, it must start with an empty string.
(u'',u'whatever',u'whatever2')
u'/whatever/whatever2'
If there is no hub id, raise Zope.Exceptions.NotFoundError.
"""
def getLocation(hubid):
"""Returns a location as a tuple of unicodes.
If there is no location, raise Zope.Exceptions.NotFoundError.
"""
def getObject(hubid):
"""Returns an object for the given hub id.
If there is no such hub id, raise Zope.Exceptions.NotFoundError.
If there is no such object, passes through whatever error
the traversal service raises.
"""
def register(obj_or_loc):
"""Returns a new hub id for the given location or the given
wrapped object if it is not already registered.
It also emits a HubIdObjectRegisteredEvent. Raises an
ObjectHubError if the location was previously registered.
"""
def unregister(obj_or_loc_or_hubid):
"""Unregister an object by wrapped object, by location, or by hubid.
It also emits a HubIdObjectUnregisteredEvent.
If the hub id or location wasn't registered a
Zope.Exceptions.NotFoundError is raised.
"""
def numRegistrations():
"""Returns the number of location<-->hubid registrations held.
"""
def getRegistrations(location='/'):
"""Returns a sequence of the registrations at and within the
given location.
A registration a tuple (location, hib_id).
"""
"""
Revision information:
$Id: hub.py,v 1.1.2.1 2002/12/23 19:31:53 jim Exp $
"""
from zope.interfaces.event import IEvent
from zope.interface.element import Attribute
class IHubEvent(IEvent):
"""Internal Object Hub Event : something has happened to an object for
which there is a hub id.
A hub id is a way of refering to an object independent of location.
"""
hub = Attribute(
"""the originating object hub (and thus the hub for which this
hubid is pertinent)""")
object = Attribute("The subject of the event.")
hubid = Attribute("the object's hub-unique id")
location = Attribute("An optional object location.")
class IRegistrationHubEvent(IHubEvent):
"""The hub registration status of an object has changed
"""
class IObjectRegisteredHubEvent(IRegistrationHubEvent):
"""A hub id has been freshly created and mapped against an object."""
class IObjectUnregisteredHubEvent(IRegistrationHubEvent):
"""We are no longer interested in this object."""
class IObjectModifiedHubEvent(IHubEvent):
"""An object with a hub id has been modified."""
class IObjectMovedHubEvent(IHubEvent):
"""An object with a hub id has had its context changed. Typically, this
means that it has been moved."""
fromLocation = Attribute("The old location for the object.")
class IObjectRemovedHubEvent(IObjectUnregisteredHubEvent):
"""An object with a hub id has been removed and unregistered."""
"""
Revision information:
$Id: hub.py,v 1.1.2.1 2002/12/23 19:31:53 jim Exp $
"""
from zope.interfaces.event import IEventChannel
class IHubEventChannel(IEventChannel):
"""Event channel that filters hub events.
It typically lies between the ObjectHub service and an index, so that
only certain content gets indexed. The extra iterObjectRegistrations
method is needed for bootstrapping the index with the appropriate objects.
"""
def iterObjectRegistrations():
"""Returns an iterator of the object registrations.
An object registration is a tuple (location, hubid, wrapped_object).
"""
=== Added File Zope3/src/zope/app/interfaces/services/interfaces.py ===
##############################################################################
#
# Copyright (c) 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.
#
##############################################################################
"""Service interfaces
$Id: interfaces.py,v 1.1.2.1 2002/12/23 19:31:53 jim Exp $
"""
from zope.app.interfaces.services.configuration import IConfiguration
from zope.app.component.interfacefield import InterfaceField
from zope.schema import BytesLine, TextLine, Text
from zope.interface import Interface
from zope.app.services.field import ComponentLocation
from zope.component.interfaces import IPresentation
class IAdapterConfigurationInfo(Interface):
forInterface = InterfaceField(
title = u"For interface",
description = u"The interface of the objects being adapted",
readonly = True,
required = False, # XXX the UI should be explicit about allowing
) # no selection.
providedInterface = InterfaceField(
title = u"Provided interface",
description = u"The interface provided by the adapter",
readonly = True,
required = True,
)
factoryName = BytesLine(
title=u"The dotted name of a factory for creating the adapter",
readonly = True,
required = True,
)
class IAdapterConfiguration(IConfiguration, IAdapterConfigurationInfo):
def getAdapter(object):
"""Return an adapter for the object
The adapter is computed by passing the object to the
registered factory.
"""
class IViewConfigurationInfo(Interface):
forInterface = InterfaceField(
title = u"For interface",
description = u"The interface of the objects being viewed",
readonly = True,
required = True,
)
presentationType = InterfaceField(
title = u"Presentation type",
description = u"The presentation type of a view",
readonly = True,
required = True,
type = IPresentation,
)
factoryName = BytesLine(
title=u"The dotted name of a factory for creating the view",
readonly = True,
required = True,
min_length = 1,
)
viewName = TextLine(
title = u"View name",
readonly = True,
required = True,
min_length = 1,
)
layer = BytesLine(
title = u"Layer",
description = u"The skin layer the view is registered for",
required = False,
readonly = True,
min_length = 1,
default = "default",
)
class IViewConfiguration(IConfiguration, IViewConfigurationInfo):
def getView(object, request):
"""Return an adapter for the object
The adapter is computed by passing the object to the
registered factory.
"""
class IZPTTemplate(Interface):
"""ZPT Templates for use in views
"""
contentType = BytesLine(
title=u'Content type of generated output',
required=True,
default='text/html'
)
source = Text(
title=u"Source",
description=u"""The source of the page template.""",
required=True)
def render(context, request, *args, **kw):
"""Render the page template.
The context argument is bound to the top-level 'context'
variable. The request argument is bound to the top-level
'request' variable. The positional arguments are bound to the
'args' variable and the keyword arguments are bound to the
'options' variable.
"""
class IPageConfigurationInfo(IViewConfigurationInfo):
factoryName = BytesLine(
title=u"The dotted name of a factory for creating the view",
readonly = True,
required = False,
min_length = 1,
)
template = ComponentLocation(
title = u"Page template",
required = False,
readonly = True,
type = IZPTTemplate,
)
class IPageConfiguration(IConfiguration, IPageConfigurationInfo):
def getView(object, request):
"""Return a page for the object.
"""
=== Added File Zope3/src/zope/app/interfaces/services/package.py ===
##############################################################################
#
# Copyright (c) 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.
#
##############################################################################
from zope.app.interfaces.container import IContainer
from zope.app.interfaces.services.service import IComponentManager
class IPackages(IContainer, IComponentManager):
"""Packages objects contain database packages
They support simple containment as well as package query and lookup.
"""
doc = IPackages.__doc__ + """
$Id: package.py,v 1.1.2.1 2002/12/23 19:31:53 jim Exp $
"""
"""XXX short summary goes here.
XXX longer description goes here.
$Id: package.py,v 1.1.2.1 2002/12/23 19:31:53 jim Exp $
"""
from zope.app.interfaces.container import IContainer
class IPackage(IContainer):
"""Component and component configuration containers.
"""
"""IPackageAdding
$Id: package.py,v 1.1.2.1 2002/12/23 19:31:53 jim Exp $
"""
from zope.app.interfaces.container import IAdding
class IPackageAdding(IAdding):
"""The Package Adding is special, since it is not part of the content
namespace, but has a similar functionality as a Folder. Therefore there
are views that overlap; this interface was created so that there are no
configuration conflicts."""
=== Added File Zope3/src/zope/app/interfaces/services/principalannotation.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.
#
##############################################################################
"""Service for storing IAnnotations for principals."""
from zope.interface import Interface
class IPrincipalAnnotationService(Interface):
"""Stores IAnnotations for IPrinicipals."""
def getAnnotation(principal):
"""Return object implementing IAnnotations for the givin IPrinicipal.
If there is no IAnnotations it will be created and then returned.
"""
def hasAnnotation(principal):
"""Return boolean indicating if given IPrincipal has IAnnotations."""
=== Added File Zope3/src/zope/app/interfaces/services/query.py ===
##############################################################################
#
# Copyright (c) 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.
#
##############################################################################
"""XXX short summary goes here.
XXX longer description goes here.
$Id: query.py,v 1.1.2.1 2002/12/23 19:31:53 jim Exp $
"""
from zope.interface import Interface
from zope.interface.element import Attribute
class IQueryProcessor(Interface):
input_interface = Attribute("The __implements__-like specification "
"for the input interfaces.")
output_interface = Attribute("The __implements__-like specification "
"for the output interfaces.")
def __call__(query):
"""Processes the query returning the result.
The query must be adaptable to each interface in input_interface.
The output should be adaptable to each interface in the
output_interface.
"""
"""XXX short summary goes here.
XXX longer description goes here.
$Id: query.py,v 1.1.2.1 2002/12/23 19:31:53 jim Exp $
"""
from zope.interface import Interface
class IQueryService(Interface):
def listQueries():
'''Returns a list of query registrations.
(query_id, permission_id, input_interface, output_interface)'''
def processQuery(query_id, input):
'''Processes the input, using the query registered with query_id.
The input is adapted to the input interface that is registered for
the query_id.'''
=== Added File Zope3/src/zope/app/interfaces/services/service.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: service.py,v 1.1.2.1 2002/12/23 19:31:53 jim Exp $
"""
from zope.interface import Interface
class IComponentManager(Interface):
def queryComponent(type=None, filter=None, all=0):
"""Return all components that match the given type and filter
The objects are returned a sequence of mapping objects with keys:
path -- The component path
component -- The component
all -- A flag indicating whether all component managers in
this place should be queried, or just the local one.
"""
"""
$Id: service.py,v 1.1.2.1 2002/12/23 19:31:53 jim Exp $
"""
from zope.interface import Interface
class IReadServiceManagerContainer(Interface):
def getServiceManager():
"""Returns the service manager contained in this object.
If there isn't a service manager, raise a component lookup.
"""
def queryServiceManager(default=None):
"""Returns the service manager contained in this object.
If there isn't a service manager, return the default.
"""
def hasServiceManager():
"""Query to find out if the component defines a service manager."""
Read = IReadServiceManagerContainer
class IWriteServiceManagerContainer(Interface):
def setServiceManager(sm):
"""Sets the service manager for this object."""
Write = IWriteServiceManagerContainer
class IServiceManagerContainer(IReadServiceManagerContainer,
IWriteServiceManagerContainer):
pass
"""
Revision information:
$Id: service.py,v 1.1.2.1 2002/12/23 19:31:53 jim Exp $
"""
from zope.interface import Interface
class IBindingAware(Interface):
def bound(name):
"""Inform a service components that it's providing a service
Called when an immediately-containing service manager binds
this object to perform the named service.
"""
def unbound(name):
"""Inform a service components that it's no longer providing a service
Called when an immediately-containing service manager unbinds
this object from performing the named service.
"""
"""
$Id: service.py,v 1.1.2.1 2002/12/23 19:31:53 jim Exp $
"""
from zope.component.interfaces import IServiceService
from zope.app.interfaces.services.configuration \
import INameComponentConfigurable
from zope.interface.element import Attribute
class IServiceManager(IServiceService, IComponentManager,
INameComponentConfigurable):
"""Service Managers act as containers for Services.
If a Service Manager is asked for a service, it checks for those it
contains before using a context based lookup to find another service
manager to delegate to. If no other service manager is found they defer
to the ComponentArchitecture ServiceManager which contains file based
services.
"""
Packages = Attribute("Package container")
"""
$Id: service.py,v 1.1.2.1 2002/12/23 19:31:53 jim Exp $
"""
from zope.interface import Interface
class INameResolver(Interface):
"""Objects that can resolve dotted names to objects
"""
def resolve(dotted_name):
"""Resolve the given dotted name to a module global variable.
If the name ends with a trailing dot, the last name segment
may be repeated.
"""
__doc__ = INameResolver.__doc__ + __doc__
"""
$Id: service.py,v 1.1.2.1 2002/12/23 19:31:53 jim Exp $
"""
from zope.interface.element import Attribute
from zope.app.interfaces.services.configuration \
import INamedComponentConfiguration
class IServiceConfiguration(INamedComponentConfiguration):
"""Service Configuration
Service configurations are dependent on the components that they
configure. They register themselves as component dependents.
The name of a service configuration is used to determine the service
type.
"""
__doc__ = IServiceConfiguration.__doc__ + __doc__
=== Added File Zope3/src/zope/app/interfaces/services/session.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.
#
##############################################################################
"""Interfaces for session service."""
from zope.interface import Interface
class ISessionService(Interface):
"""Manages sessions - fake state over multiple browser requests."""
def getSessionId(browserRequest):
"""Return sessionId for the given request.
If the request doesn't have an attached sessionId a new one will
be generated.
This will do whatever is possible to do the HTTP request to ensure
the session id will be preserved. Depending on the specific
method, further action might be necessary on the part of the user.
See the documentation for the specific implementation and its
interfaces.
"""
def invalidate(sessionId):
"""Destroy all attached data and invalidate the session."""
def getDataManager(name):
"""Get the ISessionDataManager for given name.
Raises KeyError if name is unknown.
"""
class IConfigureSessionService(Interface):
"""Configuration for ISessionService."""
def registerDataManager(name, dataManager):
"""Register ISessionDataManager under given name.
Raises ValueError if a data manager with that name already
"""
def unregisterDataManager(name):
"""Remove ISessionDataManager."""
class ISessionDataManager(Interface):
"""Stores data objects for sessions.
In general, a data object will be stored for each sessionId requested from
the ISessionDataManager.
Sub-interfaces should specify the interface(s) implemented by the data
objects.
"""
def getDataObject(sessionId):
"""Returns data attached to session.
Should create new object if this is a new session.
"""
def deleteData(sessionId):
"""Delete data attached to session."""