[Zope3-checkins] CVS: Zope3/src/zope/app/interfaces - __init__.py:1.2 annotation.py:1.2 dependable.py:1.2 dublincore.py:1.2 event.py:1.2 forms.py:1.2 introspector.py:1.2 rdb.py:1.2 schemagen.py:1.2 undo.py:1.2 workflow.py:1.2
Jim Fulton
jim@zope.com
Wed, 25 Dec 2002 09:13:58 -0500
Update of /cvs-repository/Zope3/src/zope/app/interfaces
In directory cvs.zope.org:/tmp/cvs-serv15352/src/zope/app/interfaces
Added Files:
__init__.py annotation.py dependable.py dublincore.py event.py
forms.py introspector.py rdb.py schemagen.py undo.py
workflow.py
Log Message:
Grand renaming:
- Renamed most files (especially python modules) to lower case.
- Moved views and interfaces into separate hierarchies within each
project, where each top-level directory under the zope package
is a separate project.
- Moved everything to src from lib/python.
lib/python will eventually go away. I need access to the cvs
repository to make this happen, however.
There are probably some bits that are broken. All tests pass
and zope runs, but I haven't tried everything. There are a number
of cleanups I'll work on tomorrow.
=== Zope3/src/zope/app/interfaces/__init__.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:13:57 2002
+++ Zope3/src/zope/app/interfaces/__init__.py Wed Dec 25 09:12:56 2002
@@ -0,0 +1,2 @@
+#
+# This file is necessary to make this directory a package.
=== Zope3/src/zope/app/interfaces/annotation.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:13:57 2002
+++ Zope3/src/zope/app/interfaces/annotation.py Wed Dec 25 09:12:56 2002
@@ -0,0 +1,74 @@
+##############################################################################
+#
+# 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$
+"""
+
+from zope.interface import Interface
+from zope.interface 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.
+ """
+
+
+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.
+ """
+
+
+class IAttributeAnnotatable(IAnnotatable):
+ """
+ Marker interface giving permission for an IAnnotations adapter to store
+ data in an attribute named __annotations__.
+ """
=== Zope3/src/zope/app/interfaces/dependable.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:13:57 2002
+++ Zope3/src/zope/app/interfaces/dependable.py Wed Dec 25 09:12:56 2002
@@ -0,0 +1,48 @@
+##############################################################################
+#
+# 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$
+"""
+
+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$
+"""
+
+class DependencyError(Exception):
+ """ This object is dependable"""
=== Zope3/src/zope/app/interfaces/dublincore.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:13:57 2002
+++ Zope3/src/zope/app/interfaces/dublincore.py Wed Dec 25 09:12:56 2002
@@ -0,0 +1,318 @@
+##############################################################################
+#
+# 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$
+"""
+
+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$
+"""
+
+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$
+"""
+
+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$
+"""
+
+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__
=== Zope3/src/zope/app/interfaces/event.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:13:57 2002
+++ Zope3/src/zope/app/interfaces/event.py Wed Dec 25 09:12:56 2002
@@ -0,0 +1,82 @@
+##############################################################################
+#
+# 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$
+"""
+
+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$
+"""
+
+from zope.interfaces.event import IEvent
+from zope.interface 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.")
=== Zope3/src/zope/app/interfaces/forms.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:13:57 2002
+++ Zope3/src/zope/app/interfaces/forms.py Wed Dec 25 09:12:56 2002
@@ -0,0 +1,128 @@
+##############################################################################
+#
+# 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$
+"""
+
+
+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$
+"""
+from zope.component.interfaces import IView
+from zope.interface 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.
+ """
=== Zope3/src/zope/app/interfaces/introspector.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:13:57 2002
+++ Zope3/src/zope/app/interfaces/introspector.py Wed Dec 25 09:12:56 2002
@@ -0,0 +1,50 @@
+##############################################################################
+#
+# 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"""
=== Zope3/src/zope/app/interfaces/rdb.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:13:57 2002
+++ Zope3/src/zope/app/interfaces/rdb.py Wed Dec 25 09:12:56 2002
@@ -0,0 +1,428 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+"""Relational Database Adapter interfaces.
+
+$Id$
+"""
+from zope.interface import Interface
+from zope.interface import Attribute
+
+
+class IDBITypeInfoProvider(Interface):
+ """This object can get the Type Info for a particular DBI
+ implementation."""
+
+ def getTypeInfo():
+ """Return an IDBITypeInfo object."""
+
+
+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:
+
+ 0 = Threads may not share the module.
+ 1 = Threads may share the module, but not connections.
+ 2 = Threads may share the module and connections.
+ 3 = Threads may share the module, connections and cursors.
+
+ Sharing in the above context means that two threads may use a resource
+ without wrapping it using a mutex semaphore to implement resource
+ locking. Note that you cannot always make external resources thread
+ safe by managing access using a mutex: the resource may rely on global
+ variables or other external sources that are beyond your control.
+ """)
+
+ def getConverter(type):
+ """Return a converter function for field type matching key"""
+
+
+arraysize = 1 # default constant, symbolic
+
+class ICursor(Interface):
+ """DB API ICursor interface"""
+
+ description = Attribute("""This read-only attribute is a sequence of
+ 7-item sequences. Each of these sequences contains information
+ describing one result column: (name, type_code, display_size,
+ internal_size, precision, scale, null_ok). This attribute will be None
+ for operations that do not return rows or if the cursor has not had an
+ operation invoked via the executeXXX() method yet.
+
+ The type_code can be interpreted by comparing it to the Type Objects
+ specified in the section below. """)
+
+ arraysize = Attribute("""This read/write attribute specifies the number of
+ rows to fetch at a time with fetchmany(). It defaults to 1 meaning to
+ fetch a single row at a time.
+
+ Implementations must observe this value with respect to the
+ fetchmany() method, but are free to interact with the database a
+ single row at a time. It may also be used in the implementation of
+ executemany().
+ """)
+
+ def close():
+ """Close the cursor now (rather than whenever __del__ is called). The
+ cursor will be unusable from this point forward; an Error (or
+ subclass) exception will be raised if any operation is attempted with
+ the cursor.
+ """
+
+ def execute(operation, parameters=None):
+ """Prepare and execute a database operation (query or
+ command). Parameters may be provided as sequence or mapping and will
+ be bound to variables in the operation. Variables are specified in a
+ database-specific notation (see the module's paramstyle attribute for
+ details). [5]
+
+ A reference to the operation will be retained by the cursor. If the
+ same operation object is passed in again, then the cursor can optimize
+ its behavior. This is most effective for algorithms where the same
+ operation is used, but different parameters are bound to it (many
+ times).
+
+ For maximum efficiency when reusing an operation, it is best to use
+ the setinputsizes() method to specify the parameter types and sizes
+ ahead of time. It is legal for a parameter to not match the predefined
+ information; the implementation should compensate, possibly with a
+ loss of efficiency.
+
+ The parameters may also be specified as list of tuples to e.g. insert
+ multiple rows in a single operation, but this kind of usage is
+ depreciated: executemany() should be used instead.
+
+ Return values are not defined.
+ """
+
+
+ def executemany(operation, seq_of_parameters):
+ """Prepare a database operation (query or command) and then execute it
+ against all parameter sequences or mappings found in the sequence
+ seq_of_parameters.
+
+ Modules are free to implement this method using multiple calls to the
+ execute() method or by using array operations to have the database
+ process the sequence as a whole in one call.
+
+ The same comments as for execute() also apply accordingly to this
+ method.
+
+ Return values are not defined.
+ """
+
+ def fetchone():
+ """Fetch the next row of a query result set, returning a single
+ sequence, or None when no more data is available. [6]
+
+ An Error (or subclass) exception is raised if the previous call to
+ executeXXX() did not produce any result set or no call was issued yet.
+ """
+
+ def fetchmany(size=arraysize):
+ """Fetch the next set of rows of a query result, returning a sequence
+ of sequences (e.g. a list of tuples). An empty sequence is returned
+ when no more rows are available.
+
+ The number of rows to fetch per call is specified by the parameter. If
+ it is not given, the cursor's arraysize determines the number of rows
+ to be fetched. The method should try to fetch as many rows as
+ indicated by the size parameter. If this is not possible due to the
+ specified number of rows not being available, fewer rows may be
+ returned.
+
+ An Error (or subclass) exception is raised if the previous call to
+ executeXXX() did not produce any result set or no call was issued yet.
+
+ Note there are performance considerations involved with the size
+ parameter. For optimal performance, it is usually best to use the
+ arraysize attribute. If the size parameter is used, then it is best
+ for it to retain the same value from one fetchmany() call to the next.
+ """
+
+ def fetchall():
+ """Fetch all (remaining) rows of a query result, returning them as a
+ sequence of sequences (e.g. a list of tuples). Note that the cursor's
+ arraysize attribute can affect the performance of this operation.
+
+ An Error (or subclass) exception is raised if the previous call to
+ executeXXX() did not produce any result set or no call was issued yet.
+ """
+
+
+class IResultSet(Interface):
+ """Holds results, and allows iteration."""
+
+ columns = Attribute("""A list of the column names of the returned result
+ set.""")
+
+ def __getitem__(index):
+ """Return a brain row for index."""
+
+
+class DatabaseException(Exception):
+ """Generic Database Error"""
+
+ def __init__(self, message):
+ self.message = message
+
+ def __str__(self):
+ return self.message
+
+
+class IDBICursor(Interface):
+ """DB API ICursor interface"""
+
+ description = Attribute("""This read-only attribute is a sequence of
+ 7-item sequences. Each of these sequences contains information
+ describing one result column: (name, type_code, display_size,
+ internal_size, precision, scale, null_ok). This attribute will be None
+ for operations that do not return rows or if the cursor has not had an
+ operation invoked via the executeXXX() method yet.
+
+ The type_code can be interpreted by comparing it to the Type Objects
+ specified in the section below. """)
+
+ arraysize = Attribute("""This read/write attribute specifies the number of
+ rows to fetch at a time with fetchmany(). It defaults to 1 meaning to
+ fetch a single row at a time.
+
+ Implementations must observe this value with respect to the
+ fetchmany() method, but are free to interact with the database a
+ single row at a time. It may also be used in the implementation of
+ executemany().
+ """)
+
+ def close():
+ """Close the cursor now (rather than whenever __del__ is called). The
+ cursor will be unusable from this point forward; an Error (or
+ subclass) exception will be raised if any operation is attempted with
+ the cursor.
+ """
+
+ def execute(operation, parameters=None):
+ """Prepare and execute a database operation (query or
+ command). Parameters may be provided as sequence or mapping and will
+ be bound to variables in the operation. Variables are specified in a
+ database-specific notation (see the module's paramstyle attribute for
+ details). [5]
+
+ A reference to the operation will be retained by the cursor. If the
+ same operation object is passed in again, then the cursor can optimize
+ its behavior. This is most effective for algorithms where the same
+ operation is used, but different parameters are bound to it (many
+ times).
+
+ For maximum efficiency when reusing an operation, it is best to use
+ the setinputsizes() method to specify the parameter types and sizes
+ ahead of time. It is legal for a parameter to not match the predefined
+ information; the implementation should compensate, possibly with a
+ loss of efficiency.
+
+ The parameters may also be specified as list of tuples to e.g. insert
+ multiple rows in a single operation, but this kind of usage is
+ depreciated: executemany() should be used instead.
+
+ Return values are not defined.
+ """
+
+
+ def executemany(operation, seq_of_parameters):
+ """Prepare a database operation (query or command) and then execute it
+ against all parameter sequences or mappings found in the sequence
+ seq_of_parameters.
+
+ Modules are free to implement this method using multiple calls to the
+ execute() method or by using array operations to have the database
+ process the sequence as a whole in one call.
+
+ The same comments as for execute() also apply accordingly to this
+ method.
+
+ Return values are not defined.
+ """
+
+ def fetchone():
+ """Fetch the next row of a query result set, returning a single
+ sequence, or None when no more data is available. [6]
+
+ An Error (or subclass) exception is raised if the previous call to
+ executeXXX() did not produce any result set or no call was issued yet.
+ """
+
+ def fetchmany(size=arraysize):
+ """Fetch the next set of rows of a query result, returning a sequence
+ of sequences (e.g. a list of tuples). An empty sequence is returned
+ when no more rows are available.
+
+ The number of rows to fetch per call is specified by the parameter. If
+ it is not given, the cursor's arraysize determines the number of rows
+ to be fetched. The method should try to fetch as many rows as
+ indicated by the size parameter. If this is not possible due to the
+ specified number of rows not being available, fewer rows may be
+ returned.
+
+ An Error (or subclass) exception is raised if the previous call to
+ executeXXX() did not produce any result set or no call was issued yet.
+
+ Note there are performance considerations involved with the size
+ parameter. For optimal performance, it is usually best to use the
+ arraysize attribute. If the size parameter is used, then it is best
+ for it to retain the same value from one fetchmany() call to the next.
+ """
+
+ def fetchall():
+ """ Fetch all (remaining) rows of a query result, returning them as a
+ sequence of sequences (e.g. a list of tuples). Note that the cursor's
+ arraysize attribute can affect the performance of this operation.
+
+ An Error (or subclass) exception is raised if the previous call to
+ executeXXX() did not produce any result set or no call was issued yet.
+ """
+
+
+class IConnectionService(Interface):
+
+ def getConnection(name):
+ """Returns a connection object by name."""
+
+ def queryConnection(name, default):
+ """Returns a connection object by name or default."""
+
+ def getAvailableConnections():
+ """Returns the connections available from this connection service."""
+
+
+class IDBIConnection(Interface):
+ """A DB-API based Interface """
+
+ def cursor():
+ """Return a new ICursor Object using the connection.
+
+ If the database does not provide a direct cursor concept, the module
+ will have to emulate cursors using other means to the extent needed by
+ this specification. """
+
+ def commit():
+ """Commit any pending transaction to the database. Note that if the
+ database supports an auto-commit feature, this must be initially off.
+ An interface method may be provided to turn it back on.
+
+ Database modules that do not support transactions should implement
+ 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. """
+
+
+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"""
+
+
+
+class IZopeDatabaseAdapter(IDBITypeInfo):
+ """Interface for persistent object that returns
+ volatile IZopeConnections.
+
+ This object is internal to the connection service."""
+
+ def setDSN(dsn):
+ """Set the DSN for the Adapter instance"""
+
+ def getDSN():
+ """Get the DSN of the Adapter instance"""
+
+ def connect():
+ """Connect to the specified database."""
+
+ def disconnect():
+ """Disconnect from the database."""
+
+ def isConnected():
+ """Check whether the Zope Connection is actually connected to the
+ database."""
+
+ def __call__():
+ """Return an IZopeConnection object"""
+
+
+class IZopeConnection(IDBIConnection, IDBITypeInfoProvider):
+
+ # XXX What does the next paragraph mean?
+
+ # An implementation of this object will be exposed to the
+ # user. Therefore the Zope connection represents a connection in
+ # the Zope sense, meaning that the object might not be actually
+ # connected to a database.
+
+ def cursor():
+ """Return an IZopeCursor object."""
+
+ def registerForTxn():
+ """Join the current transaction.
+
+ This method should only be inovoked by the Zope/DB transaction
+ manager.
+ """
+
+
+class IZopeCursor(IDBICursor):
+ """An ICursor that integrates with Zope's transactions"""
+
+ def execute(operation, parameters=None):
+ """Executes an operation, registering the underlying connection with
+ the transaction system.
+
+ See ICursor for more detailed execute information.
+ """
+
+ def executemany(operation, seq_of_parameters=None):
+ """Executes an operation, registering the underlying connection with
+ the transaction system.
+
+ See ICursor for more detailed executemany information.
+ """
=== Zope3/src/zope/app/interfaces/schemagen.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:13:57 2002
+++ Zope3/src/zope/app/interfaces/schemagen.py Wed Dec 25 09:12:56 2002
@@ -0,0 +1,66 @@
+##############################################################################
+#
+# 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$
+"""
+
+from zope.interface import Interface, 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
=== Zope3/src/zope/app/interfaces/undo.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:13:57 2002
+++ Zope3/src/zope/app/interfaces/undo.py Wed Dec 25 09:12:56 2002
@@ -0,0 +1,40 @@
+##############################################################################
+#
+# 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.
+ """
=== Zope3/src/zope/app/interfaces/workflow.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:13:57 2002
+++ Zope3/src/zope/app/interfaces/workflow.py Wed Dec 25 09:12:56 2002
@@ -0,0 +1,334 @@
+##############################################################################
+#
+# 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):
+ """
+ """