[Checkins] SVN: zope.browser/trunk/ Move ``IAdding`` interface here from ``zope.app.container.interfaces``.

Tres Seaver tseaver at palladion.com
Wed May 13 17:11:35 EDT 2009


Log message for revision 99927:
  Move ``IAdding`` interface here from ``zope.app.container.interfaces``.
  
  o Breaks undesirable dependencies.
  

Changed:
  U   zope.browser/trunk/CHANGES.txt
  U   zope.browser/trunk/setup.py
  U   zope.browser/trunk/src/zope/browser/README.txt
  U   zope.browser/trunk/src/zope/browser/interfaces.py

-=-
Modified: zope.browser/trunk/CHANGES.txt
===================================================================
--- zope.browser/trunk/CHANGES.txt	2009-05-13 21:07:51 UTC (rev 99926)
+++ zope.browser/trunk/CHANGES.txt	2009-05-13 21:11:35 UTC (rev 99927)
@@ -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)
 ----------------
 

Modified: zope.browser/trunk/setup.py
===================================================================
--- zope.browser/trunk/setup.py	2009-05-13 21:07:51 UTC (rev 99926)
+++ zope.browser/trunk/setup.py	2009-05-13 21:11:35 UTC (rev 99927)
@@ -24,7 +24,7 @@
     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 at zope.org',
     description='Shared Zope Toolkit browser components',

Modified: zope.browser/trunk/src/zope/browser/README.txt
===================================================================
--- zope.browser/trunk/src/zope/browser/README.txt	2009-05-13 21:07:51 UTC (rev 99926)
+++ zope.browser/trunk/src/zope/browser/README.txt	2009-05-13 21:11:35 UTC (rev 99927)
@@ -31,6 +31,23 @@
   >>> 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
 ------
 

Modified: zope.browser/trunk/src/zope/browser/interfaces.py
===================================================================
--- zope.browser/trunk/src/zope/browser/interfaces.py	2009-05-13 21:07:51 UTC (rev 99926)
+++ zope.browser/trunk/src/zope/browser/interfaces.py	2009-05-13 21:11:35 UTC (rev 99927)
@@ -31,6 +31,60 @@
       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.
     """



More information about the Checkins mailing list