summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES.txt6
-rw-r--r--setup.py2
-rw-r--r--src/zope/browser/README.txt17
-rw-r--r--src/zope/browser/interfaces.py54
4 files changed, 78 insertions, 1 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index f799133..3ce5060 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,6 +1,12 @@
zope.browser Changelog
======================
+1.1 (unreleased)
+----------------
+
+- Moved ``IAdding`` interface here from ``zope.app.container.interfaces``
+ to break undesirable dependencies.
+
1.0 (2009-05-13)
----------------
diff --git a/setup.py b/setup.py
index d095a0c..98c2c48 100644
--- a/setup.py
+++ b/setup.py
@@ -24,7 +24,7 @@ def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
setup(name='zope.browser',
- version = '1.0',
+ version = '1.1dev',
author='Zope Corporation and Contributors',
author_email='zope3-dev@zope.org',
description='Shared Zope Toolkit browser components',
diff --git a/src/zope/browser/README.txt b/src/zope/browser/README.txt
index d6ae4d2..b387a55 100644
--- a/src/zope/browser/README.txt
+++ b/src/zope/browser/README.txt
@@ -31,6 +31,23 @@ and an interface derived from ``IView``:
>>> 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``:
+
+.. doctest::
+
+ >>> from zope.interface import Interface
+ >>> from zope.browser.interfaces import IAdding
+ >>> Interface.providedBy(IBrowserView)
+ True
+ >>> IAdding.extends(IBrowserView)
+ True
+
ITerms
------
diff --git a/src/zope/browser/interfaces.py b/src/zope/browser/interfaces.py
index b0c5788..6588890 100644
--- a/src/zope/browser/interfaces.py
+++ b/src/zope/browser/interfaces.py
@@ -31,6 +31,60 @@ class IBrowserView(IView):
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.
"""