summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTres Seaver <tseaver@palladion.com>2009-05-13 21:11:35 +0000
committerTres Seaver <tseaver@palladion.com>2009-05-13 21:11:35 +0000
commit0911960d355963901b228f5ac0cd810f3f5c04ab (patch)
treed4cf183321e5cb347e13f6a6c14816633e2282ff /src
parentad77f8b236fc336049f5f82094ed84be258c592b (diff)
downloadzope-browser-0911960d355963901b228f5ac0cd810f3f5c04ab.tar.gz
Move ``IAdding`` interface here from ``zope.app.container.interfaces``.
o Breaks undesirable dependencies.
Diffstat (limited to 'src')
-rw-r--r--src/zope/browser/README.txt17
-rw-r--r--src/zope/browser/interfaces.py54
2 files changed, 71 insertions, 0 deletions
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.
"""