From 6b6fe742e9a2535ca33a4b310a7e832cad31b824 Mon Sep 17 00:00:00 2001 From: Hanno Schlichting Date: Fri, 30 Apr 2010 17:42:26 +0000 Subject: Update bootstrap and add missing svn:eol-style --- src/zope/__init__.py | 14 +-- src/zope/browser/__init__.py | 2 +- src/zope/browser/interfaces.py | 218 ++++++++++++++++++++--------------------- src/zope/browser/tests.py | 64 ++++++------ 4 files changed, 149 insertions(+), 149 deletions(-) (limited to 'src') diff --git a/src/zope/__init__.py b/src/zope/__init__.py index c2c4975..2e2033b 100644 --- a/src/zope/__init__.py +++ b/src/zope/__init__.py @@ -1,7 +1,7 @@ -# this is a namespace package -try: - import pkg_resources - pkg_resources.declare_namespace(__name__) -except ImportError: - import pkgutil - __path__ = pkgutil.extend_path(__path__, __name__) +# this is a namespace package +try: + import pkg_resources + pkg_resources.declare_namespace(__name__) +except ImportError: + import pkgutil + __path__ = pkgutil.extend_path(__path__, __name__) diff --git a/src/zope/browser/__init__.py b/src/zope/browser/__init__.py index e7ae9de..4014849 100644 --- a/src/zope/browser/__init__.py +++ b/src/zope/browser/__init__.py @@ -1 +1 @@ -# make a package +# make a package diff --git a/src/zope/browser/interfaces.py b/src/zope/browser/interfaces.py index efa5c80..00eb9b7 100644 --- a/src/zope/browser/interfaces.py +++ b/src/zope/browser/interfaces.py @@ -1,109 +1,109 @@ -############################################################################## -# -# Copyright (c) 2004-2009 Zope Corporation and Contributors. -# All Rights Reserved. -# -# This software is subject to the provisions of the Zope Public License, -# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. -# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED -# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS -# FOR A PARTICULAR PURPOSE. -# -############################################################################## -"""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 - - o 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``. - """ - 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. - """ - def getTerm(value): - """Return an ITitledTokenizedTerm object for the given value - - LookupError is raised if the value isn't in the source - """ - - def getValue(token): - """Return a value for a given identifier token - - 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 - """ +############################################################################## +# +# Copyright (c) 2004-2009 Zope Corporation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +"""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 + + o 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``. + """ + 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. + """ + def getTerm(value): + """Return an ITitledTokenizedTerm object for the given value + + LookupError is raised if the value isn't in the source + """ + + def getValue(token): + """Return a value for a given identifier token + + 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 + """ diff --git a/src/zope/browser/tests.py b/src/zope/browser/tests.py index dac1209..29b15fa 100644 --- a/src/zope/browser/tests.py +++ b/src/zope/browser/tests.py @@ -1,32 +1,32 @@ -############################################################################## -# -# Copyright (c) 2007 Zope Foundation and Contributors. -# All Rights Reserved. -# -# This software is subject to the provisions of the Zope Public License, -# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. -# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED -# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS -# FOR A PARTICULAR PURPOSE. -# -############################################################################## -""" -$Id:$ -""" -__docformat__ = "reStructuredText" - -import unittest -from zope.testing import doctest - - -def test_suite(): - return unittest.TestSuite(( - doctest.DocFileSuite('README.txt', - optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS, - ), - )) - - -if __name__ == '__main__': - unittest.main(defaultTest='test_suite') +############################################################################## +# +# Copyright (c) 2007 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +""" +$Id:$ +""" +__docformat__ = "reStructuredText" + +import unittest +from zope.testing import doctest + + +def test_suite(): + return unittest.TestSuite(( + doctest.DocFileSuite('README.txt', + optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS, + ), + )) + + +if __name__ == '__main__': + unittest.main(defaultTest='test_suite') -- cgit v1.2.1