[Checkins] SVN: zope.browser/branches/publisher_definition/ Creating a branch out of the trunk that declares the request/publisher related interfaces
Souheil CHELFOUH
souheil at chelfouh.com
Thu Mar 24 21:03:11 EDT 2011
Log message for revision 121119:
Creating a branch out of the trunk that declares the request/publisher related interfaces
Changed:
A zope.browser/branches/publisher_definition/
D zope.browser/branches/publisher_definition/CHANGES.txt
A zope.browser/branches/publisher_definition/CHANGES.txt
D zope.browser/branches/publisher_definition/README.txt
A zope.browser/branches/publisher_definition/README.txt
D zope.browser/branches/publisher_definition/setup.py
A zope.browser/branches/publisher_definition/setup.py
D zope.browser/branches/publisher_definition/src/zope/browser/README.txt
A zope.browser/branches/publisher_definition/src/zope/browser/README.txt
D zope.browser/branches/publisher_definition/src/zope/browser/interfaces.py
A zope.browser/branches/publisher_definition/src/zope/browser/interfaces.py
-=-
Deleted: zope.browser/branches/publisher_definition/CHANGES.txt
===================================================================
--- zope.browser/trunk/CHANGES.txt 2011-03-24 07:47:50 UTC (rev 121104)
+++ zope.browser/branches/publisher_definition/CHANGES.txt 2011-03-25 01:03:10 UTC (rev 121119)
@@ -1,39 +0,0 @@
-Changelog
-=========
-
-1.3.1 (unreleased)
-------------------
-
-
-1.3 (2010-04-30)
-----------------
-
-- Removed test extra and zope.testing dependency.
-
-1.2 (2009-05-18)
-----------------
-
-- Moved ``ISystemErrorView`` interface here from
- ``zope.app.exception`` to break undesirable dependencies.
-
-- Fixed home page and author's e-mail address.
-
-- Added doctests to long_description.
-
-1.1 (2009-05-13)
-----------------
-
-- Moved ``IAdding`` interface here from ``zope.app.container.interfaces``
- to break undesirable dependencies.
-
-1.0 (2009-05-13)
-----------------
-
-- Moved ``IView`` and ``IBrowserView`` interfaces here from
- ``zope.publisher.interfaces`` to break undesirable dependencies.
-
-0.5.0 (2008-12-11)
-------------------
-
-- Moved ``ITerms`` interface here from ``zope.app.form.browser.interfaces``
- to break undesirable dependencies.
Copied: zope.browser/branches/publisher_definition/CHANGES.txt (from rev 121117, zope.browser/trunk/CHANGES.txt)
===================================================================
--- zope.browser/branches/publisher_definition/CHANGES.txt (rev 0)
+++ zope.browser/branches/publisher_definition/CHANGES.txt 2011-03-25 01:03:10 UTC (rev 121119)
@@ -0,0 +1,56 @@
+Changelog
+=========
+
+1.4 (unreleased)
+----------------
+
+Added definitions to the base browser publishing process, including :
+
+ * IRequest and IResponse
+ * IPublisher
+ * Errors definitions with : IPublishingError, IBadRequest, INotFound
+ and IRedirect
+ * Views publishing help : IDefaultViewName, that permits to retrieve
+ the name of the default view for a context.
+
+This allows us to move toward a greater interoperability with other
+systems, severing a lot of zope packages' ties with ``zope.publisher``,
+where all these concepts were initially defined. ``zope.publisher`` will
+now use these interfaces as mixins to create zope publication
+specific definitions. Components that don't need the full blow
+definition can now register on broader interfaces, making them
+available to non ``zope.publisher`` aware applications.
+
+
+1.3 (2010-04-30)
+----------------
+
+- Removed test extra and zope.testing dependency.
+
+1.2 (2009-05-18)
+----------------
+
+- Moved ``ISystemErrorView`` interface here from
+ ``zope.app.exception`` to break undesirable dependencies.
+
+- Fixed home page and author's e-mail address.
+
+- Added doctests to long_description.
+
+1.1 (2009-05-13)
+----------------
+
+- Moved ``IAdding`` interface here from ``zope.app.container.interfaces``
+ to break undesirable dependencies.
+
+1.0 (2009-05-13)
+----------------
+
+- Moved ``IView`` and ``IBrowserView`` interfaces here from
+ ``zope.publisher.interfaces`` to break undesirable dependencies.
+
+0.5.0 (2008-12-11)
+------------------
+
+- Moved ``ITerms`` interface here from ``zope.app.form.browser.interfaces``
+ to break undesirable dependencies.
Deleted: zope.browser/branches/publisher_definition/README.txt
===================================================================
--- zope.browser/trunk/README.txt 2011-03-24 07:47:50 UTC (rev 121104)
+++ zope.browser/branches/publisher_definition/README.txt 2011-03-25 01:03:10 UTC (rev 121119)
@@ -1,4 +0,0 @@
-zope.browser
-============
-
-This package provides shared browser components for the Zope Toolkit.
Copied: zope.browser/branches/publisher_definition/README.txt (from rev 121117, zope.browser/trunk/README.txt)
===================================================================
--- zope.browser/branches/publisher_definition/README.txt (rev 0)
+++ zope.browser/branches/publisher_definition/README.txt 2011-03-25 01:03:10 UTC (rev 121119)
@@ -0,0 +1,8 @@
+zope.browser
+============
+
+This package provides shared browser components for the Zope
+Toolkit. It defines the base actors for an interaction with a browser,
+including the publishing process, from the request to the response and
+the MVC oriented components. This ensures the pluggability and the
+general interoperability of the publishing mechanisms and protagonists.
Deleted: zope.browser/branches/publisher_definition/setup.py
===================================================================
--- zope.browser/trunk/setup.py 2011-03-24 07:47:50 UTC (rev 121104)
+++ zope.browser/branches/publisher_definition/setup.py 2011-03-25 01:03:10 UTC (rev 121119)
@@ -1,58 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2006 Zope Foundation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (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.
-#
-##############################################################################
-"""Setup for zope.browser package
-"""
-
-import os
-
-from setuptools import setup, find_packages
-
-def read(*rnames):
- return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
-
-setup(name='zope.browser',
- version = '1.3.1dev',
- author='Zope Foundation and Contributors',
- author_email='zope-dev at zope.org',
- description='Shared Zope Toolkit browser components',
- long_description=(
- read('README.txt')
- + '\n\n.. contents::\n\n' +
- read('src', 'zope', 'browser', 'README.txt')
- + '\n\n' +
- read('CHANGES.txt')
- ),
- license='ZPL 2.1',
- keywords = "zope browser component",
- classifiers = [
- 'Development Status :: 5 - Production/Stable',
- 'Environment :: Web Environment',
- 'Intended Audience :: Developers',
- 'License :: OSI Approved :: Zope Public License',
- 'Programming Language :: Python',
- 'Natural Language :: English',
- 'Operating System :: OS Independent',
- 'Topic :: Internet :: WWW/HTTP',
- 'Framework :: Zope3'],
- url='http://pypi.python.org/pypi/zope.browser',
- packages=find_packages('src'),
- package_dir = {'': 'src'},
- namespace_packages=['zope',],
- install_requires=[
- 'setuptools',
- 'zope.interface',
- ],
- include_package_data = True,
- zip_safe = False,
- )
Copied: zope.browser/branches/publisher_definition/setup.py (from rev 121117, zope.browser/trunk/setup.py)
===================================================================
--- zope.browser/branches/publisher_definition/setup.py (rev 0)
+++ zope.browser/branches/publisher_definition/setup.py 2011-03-25 01:03:10 UTC (rev 121119)
@@ -0,0 +1,58 @@
+##############################################################################
+#
+# Copyright (c) 2006 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Setup for zope.browser package
+"""
+
+import os
+
+from setuptools import setup, find_packages
+
+def read(*rnames):
+ return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
+
+setup(name='zope.browser',
+ version = '1.4.0dev',
+ author='Zope Foundation and Contributors',
+ author_email='zope-dev at zope.org',
+ description='Shared Zope Toolkit browser components',
+ long_description=(
+ read('README.txt')
+ + '\n\n.. contents::\n\n' +
+ read('src', 'zope', 'browser', 'README.txt')
+ + '\n\n' +
+ read('CHANGES.txt')
+ ),
+ license='ZPL 2.1',
+ keywords = "zope browser component",
+ classifiers = [
+ 'Development Status :: 5 - Production/Stable',
+ 'Environment :: Web Environment',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: Zope Public License',
+ 'Programming Language :: Python',
+ 'Natural Language :: English',
+ 'Operating System :: OS Independent',
+ 'Topic :: Internet :: WWW/HTTP',
+ 'Framework :: Zope3'],
+ url='http://pypi.python.org/pypi/zope.browser',
+ packages=find_packages('src'),
+ package_dir = {'': 'src'},
+ namespace_packages=['zope',],
+ install_requires=[
+ 'setuptools',
+ 'zope.interface',
+ ],
+ include_package_data = True,
+ zip_safe = False,
+ )
Deleted: zope.browser/branches/publisher_definition/src/zope/browser/README.txt
===================================================================
--- zope.browser/trunk/src/zope/browser/README.txt 2011-03-24 07:47:50 UTC (rev 121104)
+++ zope.browser/branches/publisher_definition/src/zope/browser/README.txt 2011-03-25 01:03:10 UTC (rev 121119)
@@ -1,78 +0,0 @@
-IView
------
-
-Views adapt both a context and a request.
-
-There is not much we can test except that ``IView`` is importable
-and an interface:
-
- >>> from zope.interface import Interface
- >>> from zope.browser.interfaces import IView
- >>> Interface.providedBy(IView)
- True
-
-IBrowserView
--------------
-
-Browser views are views specialized for requests from a browser (e.g.,
-as distinct from WebDAV, FTP, XML-RPC, etc.).
-
-There is not much we can test except that ``IBrowserView`` is importable
-and an interface derived from ``IView``:
-
- >>> from zope.interface import Interface
- >>> from zope.browser.interfaces import IBrowserView
- >>> Interface.providedBy(IBrowserView)
- True
- >>> IBrowserView.extends(IView)
- True
-
-IAdding
--------
-
-Adding views manage how newly-created items get added to containers.
-
-There is not much we can test except that ``IAdding`` is importable
-and an interface derived from ``IBrowserView``:
-
- >>> from zope.interface import Interface
- >>> from zope.browser.interfaces import IAdding
- >>> Interface.providedBy(IBrowserView)
- True
- >>> IAdding.extends(IBrowserView)
- True
-
-ITerms
-------
-
-The ``ITerms`` interface is used as a base for ``ISource`` widget
-implementations. This interfaces get used by ``zope.app.form`` and was
-initially defined in ``zope.app.form.browser.interfaces``, which made it
-impossible to use for other packages like ``z3c.form`` wihtout depending on
-``zope.app.form``.
-
-Moving such base components / interfaces to ``zope.browser`` makes it
-possible to share them without undesirable dependencies.
-
-There is not much we can test except that ITerms is importable
-and an interface:
-
- >>> from zope.interface import Interface
- >>> from zope.browser.interfaces import ITerms
- >>> Interface.providedBy(ITerms)
- True
-
-ISystemErrorView
-----------------
-
-Views providing this interface can classify their contexts as system
-errors. These errors can be handled in a special way (e. g. more
-detailed logging).
-
-There is not much we can test except that ISystemErrorView is importable
-and an interface:
-
- >>> from zope.interface import Interface
- >>> from zope.browser.interfaces import ISystemErrorView
- >>> Interface.providedBy(ISystemErrorView)
- True
Copied: zope.browser/branches/publisher_definition/src/zope/browser/README.txt (from rev 121117, zope.browser/trunk/src/zope/browser/README.txt)
===================================================================
--- zope.browser/branches/publisher_definition/src/zope/browser/README.txt (rev 0)
+++ zope.browser/branches/publisher_definition/src/zope/browser/README.txt 2011-03-25 01:03:10 UTC (rev 121119)
@@ -0,0 +1,188 @@
+IRequest
+========
+
+Requests are the fundamental entry point of a browser request.
+
+There is not much we can test except that ``IRequest`` is importable
+and an interface:
+
+ >>> from zope.interface import Interface
+ >>> from zope.browser.interfaces import IRequest
+ >>> Interface.providedBy(IRequest)
+ True
+
+
+IResponse
+=========
+
+Naturally, each request made to the server triggers a
+response. Defined by IResponse, it mainly consist in a group of
+headers and, optionnaly, a body.
+
+There is not much we can test except that ``IResponse`` is importable
+and an interface:
+
+ >>> from zope.browser.interfaces import IResponse
+ >>> Interface.providedBy(IResponse)
+ True
+
+
+IPublisher
+==========
+
+The publisher is the component responsable, usually, in transforming a
+request into a response.
+
+There is not much we can test except that ``IPublisher`` is importable
+and an interface:
+
+ >>> from zope.browser.interfaces import IPublisher
+ >>> Interface.providedBy(IPublisher)
+ True
+
+
+
+IPublishingException
+====================
+
+A publishing exception is an exception raised during the publishing
+process. The handling of such exception is therefore often handled
+by the publisher component itself.
+
+ >>> from zope.interface.common.interfaces import IException
+ >>> from zope.browser.interfaces import IPublishingException
+ >>> Interface.providedBy(IPublishingException)
+ True
+ >>> IPublishingException.extends(IException)
+ True
+
+
+IRedirect
+---------
+
+A redirect exception is a publishing exception that interrupt the
+publishing in order to return a redirect-aware response.
+
+ >>> from zope.browser.interfaces import IRedirect
+ >>> Interface.providedBy(IRedirect)
+ True
+ >>> IRedirect.extends(IPublishingException)
+ True
+
+
+INotFound
+---------
+
+An exception meaning that the looked up object has not been found
+during the publishing process.
+
+ >>> from zope.browser.interfaces import INotFound
+ >>> from zope.interface.common.interfaces import ILookupError
+ >>> Interface.providedBy(INotFound)
+ True
+ >>> INotFound.extends(IPublishingException)
+ True
+ >>> INotFound.extends(ILookupError)
+ True
+
+
+IBadRequest
+-----------
+
+Bad request means the request is somehow malformed or erroneous.
+
+ >>> from zope.browser.interfaces import IBadRequest
+ >>> Interface.providedBy(IBadRequest)
+ True
+ >>> IBadRequest.extends(IPublishingException)
+ True
+
+
+IView
+=====
+
+Views adapt both a context and a request.
+
+There is not much we can test except that ``IView`` is importable
+and an interface:
+
+ >>> from zope.interface import Interface
+ >>> from zope.browser.interfaces import IView
+ >>> Interface.providedBy(IView)
+ True
+
+
+IBrowserView
+=============
+
+Browser views are views specialized for requests from a browser (e.g.,
+as distinct from WebDAV, FTP, XML-RPC, etc.).
+
+There is not much we can test except that ``IBrowserView`` is importable
+and an interface derived from ``IView``:
+
+ >>> from zope.browser.interfaces import IBrowserView
+ >>> Interface.providedBy(IBrowserView)
+ True
+ >>> IBrowserView.extends(IView)
+ True
+
+
+IDefaultViewName
+================
+
+A string that contains the default view name
+
+ >>> from zope.browser.interfaces import IDefaultViewName
+ >>> Interface.providedBy(IDefaultViewName)
+ True
+
+
+IAdding
+=======
+
+Adding views manage how newly=created items get added to containers.
+
+There is not much we can test except that ``IAdding`` is importable
+and an interface derived from ``IBrowserView``:
+
+ >>> from zope.browser.interfaces import IAdding
+ >>> Interface.providedBy(IBrowserView)
+ True
+ >>> IAdding.extends(IBrowserView)
+ True
+
+
+ITerms
+======
+
+The ``ITerms`` interface is used as a base for ``ISource`` widget
+implementations. This interfaces get used by ``zope.app.form`` and was
+initially defined in ``zope.app.form.browser.interfaces``, which made it
+impossible to use for other packages like ``z3c.form`` wihtout depending on
+``zope.app.form``.
+
+Moving such base components / interfaces to ``zope.browser`` makes it
+possible to share them without undesirable dependencies.
+
+There is not much we can test except that ITerms is importable
+and an interface:
+
+ >>> from zope.browser.interfaces import ITerms
+ >>> Interface.providedBy(ITerms)
+ True
+
+
+ISystemErrorView
+================
+
+Views providing this interface can classify their contexts as system
+errors. These errors can be handled in a special way (e. g. more
+detailed logging).
+
+There is not much we can test except that ISystemErrorView is importable
+and an interface:
+
+ >>> from zope.browser.interfaces import ISystemErrorView
+ >>> Interface.providedBy(ISystemErrorView)
+ True
Deleted: zope.browser/branches/publisher_definition/src/zope/browser/interfaces.py
===================================================================
--- zope.browser/trunk/src/zope/browser/interfaces.py 2011-03-24 07:47:50 UTC (rev 121104)
+++ zope.browser/branches/publisher_definition/src/zope/browser/interfaces.py 2011-03-25 01:03:10 UTC (rev 121119)
@@ -1,109 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004-2009 Zope Foundation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (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.
-#
-##############################################################################
-"""Shared dependency less Zope3 brwoser components.
-"""
-__docformat__ = 'restructuredtext'
-
-from zope.interface import Attribute
-from zope.interface import Interface
-
-class IView(Interface):
- """ Views are multi-adapters for context and request objects.
- """
- context = Attribute("The context object the view renders")
- request = Attribute("The request object driving the view")
-
-class IBrowserView(IView):
- """ Views which are specialized for requests from a browser
-
- o Such views are distinct from those geerated via WebDAV, FTP, XML-RPC,
- etc..
- """
-
-class IAdding(IBrowserView):
- """ Multi-adapter interface for views which add items to containers.
-
- o The 'context' of the view must implement ``zope.container.IContainer``.
- """
- def add(content):
- """Add content object to context.
-
- Add using the name in `contentName`.
-
- Return the added object in the context of its container.
-
- If `contentName` is already used in container, raise
- ``zope.container.interfaces.DuplicateIDError``.
- """
-
- contentName = Attribute(
- """The content name, 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.
- """
-
- def nameAllowed():
- """Return whether names can be input by the user.
- """
-
- def addingInfo():
- """Return add menu data as a sequence of mappings.
-
- Each mapping contains 'action', 'title', and possibly other keys.
-
- The result is sorted by title.
- """
-
- def isSingleMenuItem():
- """Return whether there is single menu item or not."""
-
- def hasCustomAddView():
- "This should be called only if there is `singleMenuItem` else return 0"
-
-
-class ITerms(Interface):
- """ Adapter providing lookups for vocabulary terms.
- """
- def getTerm(value):
- """Return an ITitledTokenizedTerm object for the given value
-
- LookupError is raised if the value isn't in the source
- """
-
- def getValue(token):
- """Return a value for a given identifier token
-
- LookupError is raised if there isn't a value in the source.
- """
-
-class ISystemErrorView(Interface):
- """Error views that can classify their contexts as system errors
- """
-
- def isSystemError():
- """Return a boolean indicating whether the error is a system errror
- """
Copied: zope.browser/branches/publisher_definition/src/zope/browser/interfaces.py (from rev 121117, zope.browser/trunk/src/zope/browser/interfaces.py)
===================================================================
--- zope.browser/branches/publisher_definition/src/zope/browser/interfaces.py (rev 0)
+++ zope.browser/branches/publisher_definition/src/zope/browser/interfaces.py 2011-03-25 01:03:10 UTC (rev 121119)
@@ -0,0 +1,201 @@
+##############################################################################
+#
+# Copyright (c) 2004-2009 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Shared dependency less Zope3 browser components.
+"""
+__docformat__ = 'restructuredtext'
+
+from zope.interface import Attribute, Interface
+from zope.interface.common.interfaces import IException, ILookupError
+
+
+class IRequest(Interface):
+ """A request is a directive sent by a browser to the server,
+ to retrieve a resource. It consists of a location and a set of headers.
+ This information is represented by the environment data.
+ """
+ form = Attribute("parsed GET or POST data")
+ method = Attribute("HTTP method used to query the server.")
+
+ environment = Attribute(
+ "Request environment data. This is a read-only mapping "
+ "from variable name to value.")
+
+
+class IResponse(Interface):
+ """A response is the result of the publishing process.
+ This prototypes a very basic response item, that can be
+ extended for more specific uses.
+ """
+ body = Attribute("body of the response")
+ headers = Attribute("headers of the response")
+
+ def getStatus(as_int=False):
+ """returns the status of the response.
+ """
+
+ def redirect(url, status=None, trusted=False):
+ """Sets the response for a redirect.
+ """
+
+
+class IPublisher(Interface):
+ """A publisher is charged with the task to use a request to publish
+ a resource. This is usually done by returning a response after a
+ 'traversal' operation.
+ """
+
+ def publish(request, *args, **kwargs):
+ """Publish a request
+
+ The request is expected to be an IRequest.
+ """
+
+
+class IPublishingException(IException):
+ """A publishing exception is an exception raised during the publishing
+ process. The handling of such exception is therefore handled mainly
+ by the publisher itself, opposed to the other kind of exceptions that
+ are to be handled at another stage or/and another component.
+ """
+
+
+class IRedirect(IPublishingException):
+ """A redirect exception is a publishing exception that interrupt the
+ publishing in order to return a redirect-aware response.
+ """
+
+ location = Attribute("Target location of the redirect")
+
+
+class INotFound(ILookupError, IPublishingException):
+ """An exception meaning that the looked up object has not been found
+ during the publishing process.
+ """
+
+
+class IBadRequest(IPublishingException):
+ """Bad request means the request is somehow malformed or erroneous.
+ It must have the capabilities to expose the error message when printed.
+ """
+
+ def __str__():
+ """Returns the error message.
+ """
+
+
+class IView(Interface):
+ """Views are multi-adapters for context and request objects.
+ """
+ context = Attribute("The context object the view renders")
+ request = Attribute("The request object driving the view")
+
+
+class IBrowserView(IView):
+ """Views which are specialized for requests from a browser
+
+ o Such views are distinct from those generated via WebDAV, FTP, XML-RPC,
+ etc..
+ """
+
+
+class IDefaultViewName(Interface):
+ """A string that contains the default view name
+
+ A default view name is used to select a view when a user hasn't
+ specified one.
+ """
+
+ def __str__():
+ """Returns the default view name.
+ """
+
+
+class IAdding(IBrowserView):
+ """Multi-adapter interface for views which add items to containers.
+
+ o The 'context' of the view must implement ``zope.container.IContainer``.
+ """
+
+ def add(content):
+ """Add content object to context.
+
+ Add using the name in `contentName`.
+
+ Return the added object in the context of its container.
+
+ If `contentName` is already used in container, raise
+ ``zope.container.interfaces.DuplicateIDError``.
+ """
+
+ contentName = Attribute(
+ """The content name, 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.
+ """
+
+ def nameAllowed():
+ """Return whether names can be input by the user.
+ """
+
+ def addingInfo():
+ """Return add menu data as a sequence of mappings.
+
+ Each mapping contains 'action', 'title', and possibly other keys.
+
+ The result is sorted by title.
+ """
+
+ def isSingleMenuItem():
+ """Return whether there is single menu item or not."""
+
+ def hasCustomAddView():
+ "This should be called only if there is `singleMenuItem` else return 0"
+
+
+class ITerms(Interface):
+ """Adapter providing lookups for vocabulary terms.
+ """
+ def getTerm(value):
+ """Return an ITitledTokenizedTerm object for the given value
+
+ LookupError is raised if the value isn't in the source
+ """
+
+ def getValue(token):
+ """Return a value for a given identifier token
+
+ LookupError is raised if there isn't a value in the source.
+ """
+
+
+class ISystemErrorView(Interface):
+ """Error views that can classify their contexts as system errors
+ """
+
+ def isSystemError():
+ """Return a boolean indicating whether the error is a system errror
+ """
More information about the checkins
mailing list