summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Madden <jamadden@gmail.com>2017-08-04 08:13:17 -0500
committerJason Madden <jamadden@gmail.com>2017-08-04 08:13:17 -0500
commitcae115125df33c4907c7a6a8a4c68b47a648a72e (patch)
tree6d941b324c519f12400380fd7741c88bf8ff6a49 /src
parentcd2b9dfec498c2bc6b3a25fa4edc4c002acf129c (diff)
downloadzope-browser-cae115125df33c4907c7a6a8a4c68b47a648a72e.tar.gz
Publish docs to RTD
Diffstat (limited to 'src')
-rw-r--r--src/zope/browser/README.rst (renamed from src/zope/browser/README.txt)34
-rw-r--r--src/zope/browser/interfaces.py31
-rw-r--r--src/zope/browser/tests.py7
3 files changed, 47 insertions, 25 deletions
diff --git a/src/zope/browser/README.txt b/src/zope/browser/README.rst
index 5bb99b4..a13f15e 100644
--- a/src/zope/browser/README.txt
+++ b/src/zope/browser/README.rst
@@ -1,5 +1,13 @@
+============
+ Interfaces
+============
+
+This package defines several basic interfaces.
+
+.. currentmodule:: zope.browser.interfaces
+
IView
------
+=====
Views adapt both a context and a request.
@@ -11,14 +19,16 @@ and an interface:
>>> Interface.providedBy(IView)
True
+.. autointerface:: IView
+
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``:
+and an interface derived from :class:`IView`:
>>> from zope.interface import Interface
>>> from zope.browser.interfaces import IBrowserView
@@ -27,13 +37,15 @@ and an interface derived from ``IView``:
>>> IBrowserView.extends(IView)
True
+.. autointerface:: IBrowserView
+
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``:
+and an interface derived from :class:`IBrowserView`:
>>> from zope.interface import Interface
>>> from zope.browser.interfaces import IAdding
@@ -42,8 +54,10 @@ and an interface derived from ``IBrowserView``:
>>> IAdding.extends(IBrowserView)
True
+.. autointerface:: IAdding
+
ITerms
-------
+======
The ``ITerms`` interface is used as a base for ``ISource`` widget
implementations. This interfaces get used by ``zope.app.form`` and was
@@ -62,17 +76,21 @@ and an interface:
>>> Interface.providedBy(ITerms)
True
+.. autointerface:: ITerms
+
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
+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
+
+.. autointerface:: ISystemErrorView
diff --git a/src/zope/browser/interfaces.py b/src/zope/browser/interfaces.py
index a7c0188..ff956c5 100644
--- a/src/zope/browser/interfaces.py
+++ b/src/zope/browser/interfaces.py
@@ -27,35 +27,36 @@ class IView(Interface):
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..
+ 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``.
+ The 'context' of the view must implement :obj:`zope.container.interfaces.IContainer`.
"""
+
def add(content):
"""Add content object to context.
- Add using the name in `contentName`.
+ 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``.
+ If ``contentName`` is already used in container, raise
+ :class:`zope.container.interfaces.DuplicateIDError`.
"""
contentName = Attribute(
- """The content name, usually set by the Adder traverser.
+ """The content name, usually set by the Adder traverser.
- If the content name hasn't been defined yet, returns ``None``.
+ If the content name hasn't been defined yet, returns ``None``.
- Some creation views might use this to optionally display the
- name on forms.
- """
- )
+ 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.
@@ -82,7 +83,7 @@ class IAdding(IBrowserView):
"""Return whether there is single menu item or not."""
def hasCustomAddView():
- "This should be called only if there is `singleMenuItem` else return 0"
+ "This should be called only if there is ``singleMenuItem`` else return 0"
class ITerms(Interface):
@@ -91,7 +92,9 @@ class ITerms(Interface):
def getTerm(value):
"""Return an ITitledTokenizedTerm object for the given value
- LookupError is raised if the value isn't in the source
+ LookupError is raised if the value isn't in the source.
+
+ The return value should have the ``token`` and ``title`` attributes.
"""
def getValue(token):
diff --git a/src/zope/browser/tests.py b/src/zope/browser/tests.py
index 6df50d2..a58fe7d 100644
--- a/src/zope/browser/tests.py
+++ b/src/zope/browser/tests.py
@@ -18,10 +18,11 @@ import unittest
def test_suite():
return unittest.TestSuite((
- doctest.DocFileSuite('README.txt',
+ doctest.DocFileSuite(
+ 'README.rst',
optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,
- ),
- ))
+ ),
+ ))
if __name__ == '__main__':