summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Howitz <mh@gocept.com>2020-05-20 08:29:40 +0200
committerGitHub <noreply@github.com>2020-05-20 08:29:40 +0200
commitda6a9366f0bb33eb0d3977e094e2f8b5d70f41cb (patch)
tree733d22d7c64f402733ff66aebb9752f0d829e173 /src
parentffc45c620523947518b4de4f4458c0e06b56bebf (diff)
downloadzope-browser-da6a9366f0bb33eb0d3977e094e2f8b5d70f41cb.tar.gz
Configuring for pure-python (#5)
Diffstat (limited to 'src')
-rw-r--r--src/zope/__init__.py8
-rw-r--r--src/zope/browser/interfaces.py19
-rw-r--r--src/zope/browser/tests.py6
3 files changed, 13 insertions, 20 deletions
diff --git a/src/zope/__init__.py b/src/zope/__init__.py
index 2e2033b..2a6ee8d 100644
--- a/src/zope/__init__.py
+++ b/src/zope/__init__.py
@@ -1,7 +1 @@
-# this is a namespace package
-try:
- import pkg_resources
- pkg_resources.declare_namespace(__name__)
-except ImportError:
- import pkgutil
- __path__ = pkgutil.extend_path(__path__, __name__)
+__import__('pkg_resources').declare_namespace(__name__) # pragma: nocover
diff --git a/src/zope/browser/interfaces.py b/src/zope/browser/interfaces.py
index ff956c5..8647547 100644
--- a/src/zope/browser/interfaces.py
+++ b/src/zope/browser/interfaces.py
@@ -13,17 +13,17 @@
##############################################################################
"""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
@@ -31,10 +31,12 @@ class IBrowserView(IView):
etc.
"""
+
class IAdding(IBrowserView):
""" Multi-adapter interface for views which add items to containers.
- The 'context' of the view must implement :obj:`zope.container.interfaces.IContainer`.
+ The 'context' of the view must implement
+ :obj:`zope.container.interfaces.IContainer`.
"""
def add(content):
@@ -68,8 +70,7 @@ class IAdding(IBrowserView):
"""
def nameAllowed():
- """Return whether names can be input by the user.
- """
+ """Return whether names can be input by the user."""
def addingInfo():
"""Return add menu data as a sequence of mappings.
@@ -83,7 +84,9 @@ 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):
@@ -103,10 +106,10 @@ class ITerms(Interface):
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
- """
+ """Return a boolean indicating whether the error is a system error."""
diff --git a/src/zope/browser/tests.py b/src/zope/browser/tests.py
index a58fe7d..401366c 100644
--- a/src/zope/browser/tests.py
+++ b/src/zope/browser/tests.py
@@ -20,10 +20,6 @@ def test_suite():
return unittest.TestSuite((
doctest.DocFileSuite(
'README.rst',
- optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,
+ optionflags=doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS,
),
))
-
-
-if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')