[Zope3-checkins] CVS: Zope3/src/zope/app/interfaces - __init__.py:1.1.2.1 annotation.py:1.1.2.1 container.py:1.1.2.1 dependable.py:1.1.2.1 dublincore.py:1.1.2.1 event.py:1.1.2.1 forms.py:1.1.2.1 introspector.py:1.1.2.1 rdb.py:1.1.2.1 schemagen.py:1.1.2.1 security.py:1.1.2.1 undo.py:1.1.2.1 workflow.py:1.1.2.1
Jim Fulton
jim@zope.com
Mon, 23 Dec 2002 14:31:43 -0500
Update of /cvs-repository/Zope3/src/zope/app/interfaces
In directory cvs.zope.org:/tmp/cvs-serv19908/zope/app/interfaces
Added Files:
Tag: NameGeddon-branch
__init__.py annotation.py container.py dependable.py
dublincore.py event.py forms.py introspector.py rdb.py
schemagen.py security.py undo.py workflow.py
Log Message:
Initial renaming before debugging
=== Added File Zope3/src/zope/app/interfaces/__init__.py ===
#
# This file is necessary to make this directory a package.
=== Added File Zope3/src/zope/app/interfaces/annotation.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: annotation.py,v 1.1.2.1 2002/12/23 19:31:41 jim Exp $
"""
from zope.interface import Interface
class IAnnotations(IAnnotatable):
"""
Annotations store arbitrary application data under package unique keys
"""
def __getitem__(key):
"""
Return the annotation stored under key.
Raises KeyError if key not found.
"""
def get(key, default=None):
"""
Return the annotation stored under key, returning default if not found.
"""
def __setitem__(key, memento):
"""
Store annotation under key.
In order to avoid key collisions, users of this interface must
use their dotted package name as part of the key name.
"""
def __delitem__(key):
"""
Removes the annotation stored under key.
Raises a KeyError if the key is not found.
"""
"""
$Id: annotation.py,v 1.1.2.1 2002/12/23 19:31:41 jim Exp $
"""
class IAttributeAnnotatable(IAnnotatable):
"""
Marker interface giving permission for an IAnnotations adapter to store
data in an attribute named __annotations__.
"""
"""
$Id: annotation.py,v 1.1.2.1 2002/12/23 19:31:41 jim Exp $
"""
from zope.interface import Interface
from zope.interface.element import Attribute
class IAnnotatable(Interface):
"""
Marker interface for objects that support storing annotations.
This interface says "There exists an adapter to an IAnnotations
for an object that implements IAnnotatable".
Classes should not directly declare that they implement this interface.
Instead they should implement an interface derived from this one, which
details how the annotations are to be stored, such as
IAttributeAnnotatable.
"""
=== Added File Zope3/src/zope/app/interfaces/container.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: container.py,v 1.1.2.1 2002/12/23 19:31:41 jim Exp $
"""
class IContentContainer(IWriteContainer):
"""Containers (like folders) that contain ordinary content"""
"""
Revision information:
$Id: container.py,v 1.1.2.1 2002/12/23 19:31:41 jim Exp $
"""
from zope.interface import Interface
class IAddNotifiable(Interface):
"""The Base interface for Managing Objects."""
def manage_afterAdd(object, container):
"""Hook method will call after an object is added to container."""
"""
$Id: container.py,v 1.1.2.1 2002/12/23 19:31:41 jim Exp $
"""
class IZopeItemContainer(IContainer.IItemContainer):
def __getitem__(key):
"""Return the content for the given key
Raises KeyError if the content can't be found.
The returned value will be in the context of the container.
"""
class IZopeSimpleReadContainer(IZopeItemContainer,
IContainer.ISimpleReadContainer):
"""Readable content containers
"""
def get(key, default=None):
"""Get a value for a key
The default is returned if there is no value for the key.
The value for the key will be in the context of the container.
"""
class IZopeReadContainer(IZopeSimpleReadContainer, IContainer.IReadContainer):
"""Readable containers that can be enumerated.
"""
def values():
"""Return the values of the mapping object in the context of
the container
"""
def items():
"""Return the items of the mapping object in the context
of the container
"""
class IZopeWriteContainer(IContainer.IWriteContainer):
"""An interface for the write aspects of a container."""
def setObject(key, object):
"""Add the given object to the container under the given key.
Raises a ValueError if key is an empty string, unless the
context wrapper chooses a different key.
Returns the key used, which might be different than the given key.
If the object has an adpter to IAddNotifiable then the manageAfterAdd
method on the adpter will be called after the object is added.
An IObjectAddedEvent will be published after the object is added and
after manageAfterAdd is called. The event object will be the added
object in the context of the container
An IObjectModifiedEvent will be published after the IObjectAddedEvent
is published. The event object will be the container.
"""
def __delitem__(key):
"""Delete the keyd object from the context of the container.
Raises a KeyError if the object is not found.
If the object has an adpter to IDeleteNotifiable then the
manageBeforeDeleteObject method on the adpter will be called before
the object is removed.
An IObjectRemovedEvent will be published before the object is
removed and before manageBeforeDeleteObject is called.
The event object will be the removed from the context of the container
An IObjectModifiedEvent will be published after the IObjectRemovedEvent
is published. The event object will be the container.
"""
class IZopeContainer(IZopeReadContainer, IZopeWriteContainer, IContainer.IContainer):
"""Readable and writable content container."""
"""
Revision information:
$Id: container.py,v 1.1.2.1 2002/12/23 19:31:41 jim Exp $
"""
from zope.interface import Interface
class IDeleteNotifiable(Interface):
"""The Base interface for Managing Objects."""
def manage_beforeDelete(object, container):
"""Hook method will call before object is removed from container."""
"""Define adder component for folders.
$Id: container.py,v 1.1.2.1 2002/12/23 19:31:41 jim Exp $
"""
class DuplicateIDError(KeyError):
pass
class ContainerError(Exception):
"""An error of a container with one of its components."""
class UnaddableError(ContainerError):
"""An object cannot be added to a container."""
def __init__(self, container, obj, message=""):
self.container = container
self.obj = obj
self.message = message and ": %s" % message
def __str__(self):
return ("%(obj)s cannot be added "
"to %(container)s%(message)s" % self.__dict__)
"""
$Id: container.py,v 1.1.2.1 2002/12/23 19:31:41 jim Exp $
"""
from zope.interface.element import Attribute
from zope.component.interfaces import IView
class IAdding(IView):
def add(content):
"""Add content object to container.
Add using the name in contentName. Returns the added object
in the context of its container.
If contentName is already used in container, raises
Zope.App.OFS.Container.Exceptions.DuplicateIDError.
"""
contentName = Attribute(
"""The content name, as usually set by the Adder traverser.
If the content name hasn't been defined yet, returns None.
Some creation views might use this to optionally display the
name on forms.
"""
)
def nextURL():
"""Return the URL that the creation view should redirect to.
This is called by the creation view after calling add.
It is the adder's responsibility, not the creation view's to
decide what page to display after content is added.
"""
"""Container interfaces
$Id: container.py,v 1.1.2.1 2002/12/23 19:31:41 jim Exp $
"""
from zope.interface import Interface
from zope.interface.common.mapping import IReadMapping, IEnumerableMapping
class IItemContainer(Interface):
def __getitem__(key):
"""Return the content for the given key.
Raises KeyError if the content can't be found.
"""
class ISimpleReadContainer(IItemContainer, IReadMapping):
"""Readable content containers
"""
class IReadContainer(ISimpleReadContainer, IEnumerableMapping):
"""Readable containers that can be enumerated.
"""
class IWriteContainer(Interface):
"""An interface for the write aspects of a container."""
def setObject(key, object):
"""Add the given object to the container under the given key.
Raises a ValueError if key is an empty string, unless the
container chooses a different key.
Raises a TypeError if the key is not a unicode or ascii string.
Returns the key used, which might be different than the given key.
"""
def __delitem__(key):
"""Delete the keyed object from the container.
Raises a KeyError if the object is not found.
"""
class IContainer(IReadContainer, IWriteContainer):
"""Readable and writable content container."""
class IOptionalNamesContainer(IContainer):
"""Containers that will choose names for their items if no names are given
"""
class IContainerNamesContainer(IContainer):
"""Containers that always choose names for their items
"""
=== Added File Zope3/src/zope/app/interfaces/dependable.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: dependable.py,v 1.1.2.1 2002/12/23 19:31:41 jim Exp $
"""
from zope.interface import Interface
class IDependable(Interface):
"""Objects that other objects depend on.
Note that IDependable will normally be implemented by an adapter.
"""
def addDependent(location):
"""Add a dependency to a dependent object by location
The location is the physical path to the dependent object.
"""
def removeDependent(location):
"""Remove a dependency with a dependent object by location.
The location is the physical path to the dependent object.
"""
def dependents():
"""Return a sequence of dependent object locations.
"""
__doc__ = IDependable.__doc__ + __doc__
"""
$Id: dependable.py,v 1.1.2.1 2002/12/23 19:31:41 jim Exp $
"""
class DependencyError(Exception):
""" This object is dependable"""
=== Added File Zope3/src/zope/app/interfaces/dublincore.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: dublincore.py,v 1.1.2.1 2002/12/23 19:31:41 jim Exp $
"""
from zope.interface import Interface
from zope.schema import Text, TextLine, Datetime, Sequence
# XXX This will need to be filled out more.
class IDCDescriptiveProperties(Interface):
"""Basic descriptive meta-data properties
"""
title = TextLine(
title = u'Title',
description =
u"The first unqualified Dublin Core 'Title' element value."
)
description = Text(
title = u'Description',
description =
u"The first unqualified Dublin Core 'Description' element value.",
)
class IDCTimes(Interface):
"""Time properties
"""
created = Datetime(
title = u'Creation Date',
description =
u"The date and time that an object is created. "
u"\nThis is normally set automatically."
)
modified = Datetime(
title = u'Modification Date',
description =
u"The date and time that the object was last modified in a\n"
u"meaningful way."
)
class IDCPublishing(Interface):
"""Publishing properties
"""
effective = Datetime(
title = u'Effective Date',
description =
u"The date and time that an object should be published. "
)
expires = Datetime(
title = u'Expiration Date',
description =
u"The date and time that the object should become unpublished."
)
class IDCExtended(Interface):
"""Extended properties
This is a mized bag of properties we want but that we probably haven't
quite figured out yet.
"""
creators = Sequence(
title = u'Creators',
description = u"The unqualified Dublin Core 'Creator' element values",
value_types = (TextLine(),),
)
subjects = Sequence(
title = u'Subjects',
description = u"The unqualified Dublin Core 'Subject' element values",
value_types = (TextLine(),),
)
publisher = Text(
title = u'Publisher',
description =
u"The first unqualified Dublin Core 'Publisher' element value.",
)
contributors = Sequence(
title = u'Contributors',
description =
u"The unqualified Dublin Core 'Contributor' element values",
value_types = (TextLine(),),
)
"""
$Id: dublincore.py,v 1.1.2.1 2002/12/23 19:31:41 jim Exp $
"""
from zope.interface import Interface
class ICMFDublinCore(Interface):
"""This interface duplicates the CMF dublinc core interface.
"""
def Title():
"""Return the resource title.
The first unqualified Dublin Core 'Title' element value is
returned as a unicode string if an unqualified element is
defined, otherwise, an empty unicode string is returned.
"""
def Creator():
"""Return the resource creators.
Return the full name(s) of the author(s) of the content
object.
The unqualified Dublin Core 'Creator' element values are
returned as a sequence of unicode strings.
"""
def Subject():
"""Return the resource subjects.
The unqualified Dublin Core 'Subject' element values are
returned as a sequence of unicode strings.
"""
def Description():
"""Return the resource description
Return a natural language description of this object.
The first unqualified Dublin Core 'Description' element value is
returned as a unicode string if an unqualified element is
defined, otherwise, an empty unicode string is returned.
"""
def Publisher():
"""Dublin Core element - resource publisher
Return full formal name of the entity or person responsible
for publishing the resource.
The first unqualified Dublin Core 'Publisher' element value is
returned as a unicode string if an unqualified element is
defined, otherwise, an empty unicode string is returned.
"""
def Contributors():
"""Return the resource contributors
Return any additional collaborators.
The unqualified Dublin Core 'Contributor' element values are
returned as a sequence of unicode strings.
"""
def Date():
"""Return the default date
The first unqualified Dublin Core 'Date' element value is
returned as a unicode string if an unqualified element is
defined, otherwise, an empty unicode string is returned. The
string is formatted 'YYYY-MM-DD H24:MN:SS TZ'.
"""
def CreationDate():
"""Return the creation date.
The value of the first Dublin Core 'Date' element qualified by
'creation' is returned as a unicode string if a qualified
element is defined, otherwise, an empty unicode string is
returned. The string is formatted 'YYYY-MM-DD H24:MN:SS TZ'.
"""
def EffectiveDate():
"""Return the effective date
The value of the first Dublin Core 'Date' element qualified by
'effective' is returned as a unicode string if a qualified
element is defined, otherwise, an empty unicode string is
returned. The string is formatted 'YYYY-MM-DD H24:MN:SS TZ'.
"""
def ExpirationDate():
"""Date resource expires.
The value of the first Dublin Core 'Date' element qualified by
'expiration' is returned as a unicode string if a qualified
element is defined, otherwise, an empty unicode string is
returned. The string is formatted 'YYYY-MM-DD H24:MN:SS TZ'.
"""
def ModificationDate():
"""Date resource last modified.
The value of the first Dublin Core 'Date' element qualified by
'modification' is returned as a unicode string if a qualified
element is defined, otherwise, an empty unicode string is
returned. The string is formatted 'YYYY-MM-DD H24:MN:SS TZ'.
"""
def Type():
"""Return the resource type
Return a human-readable type name for the resource.
The first unqualified Dublin Core 'Type' element value is
returned as a unicode string if an unqualified element is
defined, otherwise, an empty unicode string is returned. The
string is formatted 'YYYY-MM-DD H24:MN:SS TZ'.
"""
def Format():
"""Return the resource format.
Return the resource's MIME type (e.g., 'text/html',
'image/png', etc.).
The first unqualified Dublin Core 'Format' element value is
returned as a unicode string if an unqualified element is
defined, otherwise, an empty unicode string is returned. The
string is formatted 'YYYY-MM-DD H24:MN:SS TZ'.
"""
def Identifier():
"""Return the URL of the resource.
This value is computed. It is included in the output of
qualifiedIdentifiers with the qualification 'url'.
"""
def Language():
"""Return the resource language.
Return the RFC language code (e.g., 'en-US', 'pt-BR')
for the resource.
The first unqualified Dublin Core 'Language' element value is
returned as a unicode string if an unqualified element is
defined, otherwise, an empty unicode string is returned. The
string is formatted 'YYYY-MM-DD H24:MN:SS TZ'.
"""
def Rights():
"""Return the resource rights.
Return a string describing the intellectual property status,
if any, of the resource. for the resource.
The first unqualified Dublin Core 'Rights' element value is
returned as a unicode string if an unqualified element is
defined, otherwise, an empty unicode string is returned. The
string is formatted 'YYYY-MM-DD H24:MN:SS TZ'.
"""
__doc__ = ICMFDublinCore.__doc__ + __doc__
"""
$Id: dublincore.py,v 1.1.2.1 2002/12/23 19:31:41 jim Exp $
"""
from zope.app.dublincore.general \
import IGeneralDublinCore, IWritableGeneralDublinCore
class IZopeDublinCore(
IGeneralDublinCore,
IWritableGeneralDublinCore,
ICMFDublinCore,
IDCDescriptiveProperties,
IDCTimes,
IDCPublishing,
IDCExtended,
):
"""Zope Dublin Core properties
"""
__doc__ = IZopeDublinCore.__doc__ + __doc__
"""
$Id: dublincore.py,v 1.1.2.1 2002/12/23 19:31:41 jim Exp $
"""
from zope.app.interfaces.annotation import IAnnotatable
class IZopeDublinCoreAnnotatable(IAnnotatable):
"""Objects that can be annotated with Zope Dublin-Core meta data
This is a marker interface that indicates the intent to have
Zope Dublin-Core meta data associated with an object.
"""
__doc__ = IZopeDublinCoreAnnotatable.__doc__ + __doc__
=== Added File Zope3/src/zope/app/interfaces/event.py ===
##############################################################################
#
# Copyright (c) 2002, 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.
#
##############################################################################
"""
Revision information:
$Id: event.py,v 1.1.2.1 2002/12/23 19:31:41 jim Exp $
"""
from zope.interfaces.event import IEvent
from zope.interfaces.event import IEventService
class IGlobalEventService(IEventService):
"""The global event-service does not allow normal subscriptions.
Subscriptions to the global event-service are not persistent.
If you want to subscribe to the global event-service, you need
to use the 'globalSubscribe' method instead of the 'subscribe'
method.
"""
def subscribe(subscriber, event_type=IEvent, filter=None):
"""Raises NotImplementedError."""
def globalSubscribe(subscriber, event_type=IEvent, filter=None):
"""Add subscriber to the list of subscribers for the channel."""
"""
Revision information:
$Id: event.py,v 1.1.2.1 2002/12/23 19:31:41 jim Exp $
"""
from zope.interfaces.event import IEvent
from zope.interface.element import Attribute
class IObjectEvent(IEvent):
"""Something has happened to an object.
The object that generated this event is not necessarily the object
refered to by location.
"""
object = Attribute("The subject of the event.")
location = Attribute("An optional object location.")
class IObjectCreatedEvent(IObjectEvent):
"""An object has been created.
The location will usually be None for this event."""
class IObjectAddedEvent(IObjectEvent):
"""An object has been added to a container."""
class IObjectModifiedEvent(IObjectEvent):
"""An object has been modified"""
class IObjectAnnotationsModifiedEvent(IObjectModifiedEvent):
"""An object's annotations have been modified"""
class IObjectContentModifiedEvent(IObjectModifiedEvent):
"""An object's content has been modified"""
class IObjectRemovedEvent(IObjectEvent):
"""An object has been removed from a container"""
class IObjectMovedEvent(IObjectEvent):
"""An object has been moved"""
fromLocation = Attribute("The old location for the object.")
=== Added File Zope3/src/zope/app/interfaces/forms.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.
#
##############################################################################
"""Validation Exceptions
$Id: forms.py,v 1.1.2.1 2002/12/23 19:31:41 jim Exp $
"""
class WidgetInputError(Exception):
"""There were one or more user input errors
"""
def __init__(self, widget_name, widget_title, errors):
Exception.__init__(self, widget_name, widget_title, errors)
self.widget_name = widget_name
self.widget_title = widget_title
self.errors = errors
class MissingInputError(WidgetInputError):
"""Required data was not supplied
"""
class ConversionError(WidgetInputError):
"""If some conversion fails, this exception is raised.
"""
def __init__(self, error_name, original_exception=None):
Exception.__init__(self, error_name, original_exception)
self.error_name = error_name
self.original_exception = original_exception
class ErrorContainer(Exception):
"""A base error class for collecting multiple errors
"""
def append(self, error):
self.args += (error, )
def __len__(self):
return len(self.args)
def __iter__(self):
return iter(self.args)
def __getitem__(self, i):
return self.args[i]
def __str__(self):
return "\n".join(
["%s: %s" % (error.__class__.__name__, error)
for error in self.args]
)
__repr__ = __str__
class WidgetsError(ErrorContainer):
"""A collection of errors from widget processing.
"""
"""
$Id: forms.py,v 1.1.2.1 2002/12/23 19:31:41 jim Exp $
"""
from zope.component.interfaces import IView
from zope.interface.element import Attribute
class IWidget(IView):
"""Generically describes the behavior of a widget.
The widget defines a list of propertyNames, which describes
what properties of the widget are available to use for
constructing the widget render output.
Note that this level must be still presentation independent.
"""
propertyNames = Attribute("""This is a list of attributes that are
defined for the widget.""")
def getValue(name):
"""Look up a Widget setting (value) by name."""
def getData():
"""Return converted and validated widget data.
If there is no user input and the field is required, then a
MissingInputError will be raised.
If there is no user input and the field is not required, then
the field default value will be returned.
A WidgetInputError is returned in the case of one or more
errors encountered, inputting, converting, or validating the data.
"""
def haveData():
"""Is there input data for the field
Return True if there is data and False otherwise.
"""
name = Attribute("""The uniquewidget name
This must be unique within a set of widgets.
""")
title = Attribute("The widget title")
required = Attribute("Flag indicating whether the field is required")
def setData(value):
"""Set the default data for the widget.
The given value should be used even if the user has entered
data.
"""
=== Added File Zope3/src/zope/app/interfaces/introspector.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.
#
##############################################################################
from zope.interface import Interface
class IIntrospector(Interface):
"""An interface for introspecting a component"""
def isInterface():
"Checks if the context is class or interface"
def setRequest(request):
"""sets the request"""
def getClass():
"""Returns the class name"""
def getBaseClassNames():
"""Returns the names of the classes"""
def getModule():
"""Returns the module name of the class"""
def getDocString():
"""Returns the description of the class"""
def getInterfaces():
"""Returns interfaces implemented by this class"""
def getInterfaceNames():
"""Returns the name of the interface"""
def getInterfaceDetails():
"""Returns the entire documentation in the interface"""
def getExtends():
"""Returns all the class extended up to the top most level"""
def getInterfaceConfiguration():
"""Returns details for a interface configuration"""
=== Added File Zope3/src/zope/app/interfaces/rdb.py === (416/516 lines abridged)
##############################################################################
#
# 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: rdb.py,v 1.1.2.1 2002/12/23 19:31:41 jim Exp $
"""
from zope.interface import Interface
class IDBITypeInfoProvider(Interface):
"""This object can get the Type Info for a particular DBI
implementation."""
def getTypeInfo():
"""Return an IDBITypeInfo object."""
"""
$Id: rdb.py,v 1.1.2.1 2002/12/23 19:31:41 jim Exp $
"""
from zope.interface import Interface
from zope.interface.element import Attribute
class IDBITypeInfo(Interface):
"""Database adapter specific information"""
paramstyle = Attribute("""
String constant stating the type of parameter marker formatting
expected by the interface. Possible values are [2]:
'qmark' = Question mark style, e.g. '...WHERE name=?'
'numeric' = Numeric, positional style, e.g. '...WHERE name=:1'
'named' = Named style, e.g. '...WHERE name=:name'
'format' = ANSI C printf format codes, e.g. '...WHERE name=%s'
'pyformat' = Python extended format codes, e.g. '...WHERE name=%(name)s'
""")
threadsafety = Attribute("""
Integer constant stating the level of thread safety the interface
supports. Possible values are:
[-=- -=- -=- 416 lines omitted -=- -=- -=-]
this method with void functionality.
"""
def rollback():
"""In case a database does provide transactions this method causes the
database to roll back to the start of any pending transaction. Closing
a connection without committing the changes first will cause an
implicit rollback to be performed. """
def close():
"""Close the connection now (rather than whenever __del__ is
called). The connection will be unusable from this point forward; an
Error (or subclass) exception will be raised if any operation is
attempted with the connection. The same applies to all cursor objects
trying to use the connection. """
"""
$Id: rdb.py,v 1.1.2.1 2002/12/23 19:31:41 jim Exp $
"""
from zope.interface import Interface
from zope.interface.element import Attribute
class ISQLCommand(Interface):
"""Static SQL commands."""
connectionName = Attribute("""The name of the database connection
to use in getConnection """)
def getConnection():
"""Get the database connection."""
def __call__():
"""Execute an sql query and return a result object if appropriate"""
__doc__ = ISQLCommand.__doc__
=== Added File Zope3/src/zope/app/interfaces/schemagen.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: schemagen.py,v 1.1.2.1 2002/12/23 19:31:41 jim Exp $
"""
from zope.interface import Interface
from zope.interface.element import Attribute
class ITypeRepresentation(Interface):
"""Provide a textual representation of object
The goal is to have a textual representation (text) that can be
'eval'ed again so it becomes an object.
"""
importList = Attribute('List of two-string tuples for use in '
'from X import Y')
text = Attribute('Textual representation of object')
def getTypes():
"""Return the sequence of types this representation can represent.
"""
class ISchemaSpec(Interface):
def addField(name, field):
"""Add a field to schema.
This should be a null operation for instances of the class
implementing the schema; FieldProperty will provide a default
for the added field.
"""
def removeField(name):
"""Remove field from schema.
"""
def renameField(orig_name, target_name):
"""Rename field.
"""
def insertField(name, field, position):
"""Insert a field at position.
"""
def moveField(name, position):
"""Move field to position.
"""
def generateModuleSource(self):
pass
=== Added File Zope3/src/zope/app/interfaces/security.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.
#
##############################################################################
"""Management interface for mappings between principals and roles."""
class IPrincipalRoleManager(IPrincipalRoleMap):
"""Management interface for mappings between principals and roles."""
def assignRoleToPrincipal(role_id, principal_id):
"""Assign the role to the principal.
"""
def removeRoleFromPrincipal(role_id, principal_id):
""" remove a role from the principal """
def unsetRoleForPrincipal(role_id, principal_id):
""" unset the role for the principal
"""
"""
$Id: security.py,v 1.1.2.1 2002/12/23 19:31:41 jim Exp $
"""
from zope.interface import Interface
class IAuthenticationService(Interface):
"""Provide support for establishing principals for requests.
This is implemented by performing protocol-specific actions,
such as issuing challenges or providing login interfaces.
IAuthenticationService objects are used to implement
authentication services. Because they implement services, they are
expected to collaborate with services in other contexts. Client
code doesn't search a context and call multiple services. Instead,
client code will call the most specific service in a place and
rely on the service to delegate to other services as necessary.
The interface doesn't include methods for data
management. Services may use external data and not allow
management in Zope. Simularly, the data to be managed may vary
with different implementations of a service.
"""
def authenticate(request):
"""Identify a principal for a request.
If a principal can be identified, then return the
principal. Otherwise, return None.
The request object is fairly opaque. We may decide
that it implements some generic request interface.
Implementation note
It is likely that the component will dispatch
to another component based on the actual
request interface. This will allow different
kinds of requests to be handled correctly.
For example, a component that authenticates
based on user names and passwords might request
an adapter for the request as in::
getpw=getAdapter(request,
ILoginPassword, place=self)
The place keyword argument is used to control
where the ILoginPassword component is
searched for. This is necessary because
requests are placeless.
"""
def unauthenticatedPrincipal():
"""Return the unauthenticated principal, if one is defined.
Return None if no unauthenticated principal is defined.
The unauthenticated principal must be an IUnauthenticatedPrincipal.
"""
def unauthorized(id, request):
"""Signal an authorization failure.
This method is called when an auhorization problem
occurs. It can perform a variety of actions, such
as issuing an HTTP authentication challenge or
displaying a login interface.
Note that the authentication service nearest to the
requested resource is called. It is up to
authentication service implementations to
colaborate with services higher in the object
hierarchy.
If no principal has been identified, id will be
None.
"""
def getPrincipal(id):
"""Get principal meta-data.
Returns an object of type IPrincipal for the given principal
id. A NotFoundError is raised if the principal cannot be
found.
Note that the authentication service nearest to the requested
resource is called. It is up to authentication service
implementations to colaborate with services higher in the
object hierarchy.
"""
def getPrincipals(name):
"""Get principals with matching names.
Get a iterable object with the principals with names that are
similar to (e.g. contain) the given name.
"""
class IPermission(IRegisteredObject):
"""A permission object."""
"""Management interface for mappings between roles and permissions."""
class IRolePermissionManager(IRolePermissionMap):
"""Management interface for mappings between roles and permissions."""
def grantPermissionToRole(permission_id, role_id):
"""Bind the permission to the role.
"""
def denyPermissionToRole(permission_id, role_id):
"""Deny the permission to the role
"""
def unsetPermissionFromRole(permission_id, role_id):
"""Clear the setting of the permission to the role.
"""
from zope.interface import Interface
class ILoginPassword(Interface):
"""A password based login.
An IAuthenticationService would use this (adapting a request),
to discover the login/password passed from the user, or to
indicate that a login is required.
"""
def getLogin():
"""Return login name, or None if no login name found."""
def getPassword():
"""Return password, or None if no login name found.
If there's a login but no password, return empty string.
"""
def needLogin(realm):
"""Indicate that a login is needed.
The realm argument is the name of the principal registry.
"""
"""Management interface for mappings between principals and permissions."""
class IPrincipalPermissionManager(IPrincipalPermissionMap):
"""Management interface for mappings between principals and permissions."""
def grantPermissionToPrincipal(permission_id, principal_id):
"""Assert that the permission is allowed for the principal.
"""
def denyPermissionToPrincipal(permission_id, principal_id):
"""Assert that the permission is denied to the principal.
"""
def unsetPermissionForPrincipal(permission_id, principal_id):
"""Remove the permission (either denied or allowed) from the
principal.
"""
"""
$Id: security.py,v 1.1.2.1 2002/12/23 19:31:41 jim Exp $
"""
from zope.interface import Interface
class IRoleService(Interface):
"""Define roles
'IRoleService' objects are used to implement role-definition
services. Because they implement services, they are expected to
collaborate with services in other contexts. Client code doesn't
sarch a context and call multiple services. Instead, client code
will call the most specific service in a place and rely on the
service to delegate to other services as necessary.
The interface doesn't include methods for data
management. Services may use external data and not allow
management in Zope. Simularly, the data to be managed may vary
with different implementations of a service.
"""
def getRole(rid):
"""Return an 'IRole' object for the given role id."""
def getRoles():
"""Return a sequence of the roles (IRole objects)
defined in the place containing the service."""
"""
$Id: security.py,v 1.1.2.1 2002/12/23 19:31:41 jim Exp $
"""
from zope.interface import Interface
class IPermissionService(Interface):
"""Manage information about permissions
'IPermissionService' objects are used to implement
permission-definition services. Because they implement services,
they are expected to collaborate with services in other
contexts. Client code doesn't search a context and call multiple
services. Instead, client code will call the most specific
service in a place and rely on the service to delegate to other
services as necessary.
The interface doesn't include methods for data
management. Services may use external data and not allow
management in Zope. Similarly, the data to be managed may vary
with different implementations of a service.
"""
def getPermission(permission_id):
"""Get permission information
Return an 'IPermission' object for the
given permission id. Return None if there is no permission defined
"""
def getPermissions():
"""Get the defined permissions
Return a sequence of the permissions
(IPermission objects) defined in the place containing the
service.
"""
"""
$Id: security.py,v 1.1.2.1 2002/12/23 19:31:41 jim Exp $
"""
class IUnauthenticatedPrincipal(IPrincipal):
"""A principal that hasn't been authenticated.
Authenticated principals are preferable to UnauthenticatedPrincipals.
"""
__doc__ = IUnauthenticatedPrincipal.__doc__ + __doc__
"""Query interface for mappings between principals and permissions."""
from zope.interface import Interface
class IPrincipalPermissionMap(Interface):
"""Mappings between principals and permissions."""
def getPrincipalsForPermission(permission_id):
"""Get the principas that have a permission.
Return the list of (principal_id, setting) tuples that describe
security assertions for this permission.
If no principals have been set for this permission, then the empty
list is returned.
"""
def getPermissionsForPrincipal(principal_id):
"""Get the permissions granted to a principal.
Return the list of (permission, setting) tuples that describe
security assertions for this principal.
If no permissions have been set for this principal, then the empty
list is returned.
"""
def getSetting(permission_id, principal_id):
"""Get the setting for a permission and principal.
Get the setting (Allow/Deny/Unset) for a given permission and
principal.
"""
def getPrincipalsAndPermissions():
"""Get all principal permission settings.
Get the principal security assertions here in the form
of a list of three tuple containing
(permission id, principal id, setting)
"""
"""Query interface for mappings between principals and roles."""
from zope.interface import Interface
class IPrincipalRoleMap(Interface):
"""Mappings between principals and roles."""
def getPrincipalsForRole(role_id):
"""Get the principals that have been granted a role.
Return the list of (principal, setting) who have been assigned or
removed from a role.
If no principals have been assigned this role,
then the empty list is returned.
"""
def getRolesForPrincipal(principal_id):
"""Get the roles granted to a principal.
Return the list of (role, setting) assigned or removed from
this principal.
If no roles have been assigned to
this principal, then the empty list is returned.
"""
def getSetting(role_id, principal_id):
"""Return the setting for this principal, role combination
"""
def getPrincipalsAndRoles():
"""Get all settings.
Return all the principal/role combinations along with the
setting for each combination as a sequence of tuples with the
role, principal, and setting, in that order.
"""
"""Query interface for mappings between roles and permissions."""
from zope.interface import Interface
class IRolePermissionMap(Interface):
"""Mappings between roles and permissions."""
def getPermissionsForRole(role_id):
"""Get the premissions granted to a role.
Return a sequence of (permission id, setting) tuples for the given
role.
If no permissions have been granted to this
role, then the empty list is returned.
"""
def getRolesForPermission(permission_id):
"""Get the roles that have a permission.
Return a sequence of (role id, setting) tuples for the given
permission.
If no roles have been granted this permission, then the empty list is
returned.
"""
def getSetting(permission_id, role_id):
"""Return the setting for the given permission id and role id
If there is no setting, Unset is returned
"""
def getRolesAndPermissions():
"""Return a sequence of (principal_id, role_id, setting) here.
The settings are returned as a sequence of permission, role,
setting tuples.
If no principal/role assertions have been made here, then the empty
list is returned.
"""
class IRole(IRegisteredObject):
"""A role object."""
"""Things that can be registered in a Registry."""
from zope.interface import Interface
class IRegisteredObject(Interface):
def getId():
"""Get the id of the registered object."""
def getTitle():
"""Get the human readable title of the registered object.
Must be a string, but it may be empty.
"""
def getDescription():
"""Get the human readable description of the registered object.
Must be a string, but it may be empty.
"""
"""
$Id: security.py,v 1.1.2.1 2002/12/23 19:31:41 jim Exp $
"""
from zope.interface import Interface
class IPrincipal(Interface):
"""Provide information about principals.
It is likely that IPrincipal objects will have associated
views used to list principals in management
interfaces. For example, a system in which other meta-data are
provided for principals might extend IPrincipal and register a
view for the extended interface that displays the extended
information. We'll probably want to define a standard view
name (e.g. 'inline_summary') for this purpose.
"""
def getId():
"""Return a unique id string for the principal."""
def getTitle():
"""Return a label for the principal
The label will be used in interfaces to allow users to make
security assertions (e.g. role or permission
assignments) about principals.
"""
def getDescription():
"""Return a description of the principal."""
=== Added File Zope3/src/zope/app/interfaces/undo.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.
#
##############################################################################
from zope.interface import Interface
class IUndoManager(Interface):
" Interface for the Undo Manager "
def getUndoInfo():
"""
Gets all undo information.
Note: at the moment, doesnt care where called from
returns sequence of mapping objects by date desc
keys of mapping objects:
id -> internal id for zodb
user_name -> name of user that last accessed the file
time -> date of last access
description -> transaction description
"""
def undoTransaction(id_list):
"""
id_list will be a list of transaction ids.
iterate over each id in list, and undo
the transaction item.
"""
=== Added File Zope3/src/zope/app/interfaces/workflow.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 workflow-related events.
"""
from zope.interface import Interface
class IWorkflowEvent( Interface ):
"""
Base interface for events related to workflow.
"""
class IWorkflowActionEvent( IWorkflowEvent ):
"""
Common base for events related to workflow-aware components
(e.g. WorkItems, for WfMC-style activity-based workflows,
or a new content object, for DCWorkflow-style document-based
workflows).
"""
def getAction():
"""
Return the workflow-aware component which the event is
"about".
"""
class IWorkflowActionCreatedEvent( IWorkflowActionEvent ):
"""
Note the creation of a new workflow-aware component (a
WorkItem, for WfMC-style activity-based workflows, or a
new content object, for DCWorkflow-style document-based
workflows.
"""
class IWorkflowActionAssignedEvent( IWorkflowActionEvent ):
"""
Note the assignment of a workflow-aware action.
"""
class IWorkflowActionBegunEvent( IWorkflowActionEvent ):
"""
Note the beginning of a workflow-aware action.
"""
class IWorkflowActionCompletedEvent(IWorkflowActionEvent):
"""
Note the completion of a WorkItem or a transition.
"""
class IWorkflowActionSuspendedEvent( IWorkflowActionEvent ):
"""
Note the suspension of a workflow-aware action.
"""
class IWorkflowActionExceptionEvent(IWorkflowActionEvent):
"""
Note that the execution of an action had an exceptional termination.
"""
"""
Interface for workitems
"""
from zope.interface import Interface
INIT = 0
BEGUN = 1
COMPLETED = 2
FAILED = 3
class WorkflowWorkitemException(Exception):
"""
Exception for workitems.
"""
class IWorkflowWorkitem(Interface):
"""
Base interface for workitems.
"""
def getProcessInstance():
"""
Get the process instance this workitem is about.
Returns a IWorkflowProcessInstance.
"""
def begin(data):
"""
Begin work on a workitem.
Can raise WorkflowWorkitemException.
"""
def complete(data):
"""
Complete work on a workitem.
Can raise WorkflowWorkitemException.
"""
def fail(data):
"""
Abort work on a workitem.
Can raise WorkflowWorkitemException.
"""
def assign(assignee, data):
"""
Assign a workitem to a principal.
assignee implements IPrincipal.
Can raise WorkflowWorkitemException.
"""
def getState():
"""
Get the internal state of the workitem.
Returns one of INIT, BEGUN, COMPLETED, FAILED.
"""
def getAssignee():
"""
Get the assignee.
Returns a IPrincipal or None.
"""
"""
Interfaces for Workflow Process Definition.
"""
from zope.interface import Interface
class IWorkflowProcessInstance( Interface ):
"""
Interface for workflow process definition.
"""
def getStatus():
"""
Report the status
"""
pass
def setActive():
"""
Change the status to Active according to the state machine
"""
pass
def setCompleted():
"""
Change the status to Completed according to the state machine
"""
pass
def listWorkitems():
"""
List all contained workitems
"""
pass
def listActiveWorkitems():
"""
List contained Active workitems
"""
pass
def listFailedWorkitems():
"""
List contained Failed workitem
"""
pass
"""
Interface for Workflow Activity Info
WAI encapsulates what can be done at a given point.
"""
from zope.interface import Interface
class IWorkflowActivityInfo(Interface):
"""
Base interface for Workflow Activity Info.
"""
def getId():
"""
Get the Activity Info id.
"""
def getTitle():
"""
Get the Activity Info title.
"""
def getCategory():
"""
Get the Activity Info category.
Returns a string (usually 'workflow').
"""
def getActionURL():
"""
Get the Activity Info URL that should be called
to trigger the action.
Returns an unencoded URL.
"""
def getPermissions():
"""
Get the permissions this Activity Info is protected by.
Returns a list of IPermission.
The Activity Info is valid if any permission matches.
"""
def getRoles():
"""
Get the roles this Activity Info is protected by.
Returns a list of IRole.
The Activity Info is valid if any role matches.
"""
def getCondition():
"""
Get the guard this Activity Info is protected by.
Returns a TALES expression (Interface ? XXX).
"""
def getSource():
"""
Get the actual action object this Activity Info is about,
for instance a workitem (task-based workflow) or a transition
(content-based workflow).
"""
"""
Interfaces for Workflow Service.
"""
from zope.interface import Interface
class IWorkflowService( Interface ):
"""
Interface for workflow service.
"""
def listEngine():
"""
Return the list of engine and their interfaces
"""
pass
def getEngine(IWorkflowEngine):
"""
Return a workflow engine giving its interface
"""
pass
def addEngine(WorkflowEngine):
"""
Add a workflow engine
"""
def removeEngine(WorkflowEngine):
"""
Remove Workflow engine from the system
"""
pass
def listWorkflowEngineActions():
"""
Return an aggregation of the actions provided
by the present engines
"""
from zope.interface import Interface
class IWorkflowEngine(Interface):
"""
Base interface for workflow engine.
"""
def getProcessInstance (process_id):
"""
"""
def listProcessInstances ():
"""
"""
def getWorklist (user, process_instance = None):
"""
"""
class IOpenflowEngine(IWorkflowEngine):
"""
Interface for activity-based workflow engine.
"""
def getProcessDefinition(process_definition_id):
"""
"""