zope.app.exception-3.6.3/0000755000177100020040000000000011566460715016413 5ustar menesismenesis00000000000000zope.app.exception-3.6.3/CHANGES.txt0000644000177100020040000000262411566460705020227 0ustar menesismenesis00000000000000CHANGES ======= 3.6.3 (2011-05-23) ------------------ - Replaced an undeclared test dependency on ``zope.app.authentication`` with ``zope.password``. 3.6.2 (2010-09-14) ------------------ - No longer depend on ``zope.app.zptpage`` for tests. - Replaced dependency on ``zope.app.securitypolicy`` by ``zope.securitypolicy``. 3.6.1 (2010-01-08) ------------------ - Require zope.browserpage which now contains ``namedtemplate``. - Fix ftesting.zcml due to ``zope.securitypolicy`` update. - Fix tests using a newer zope.publisher that requires zope.login. 3.6.0 (2009-05-18) ------------------ - ``ISystemErrorView`` interface has been moved to ``zope.browser.interfaces``, leaving BBB import here. - Cut dependency on ``zope.formlib`` by requiring newer version of ``zope.app.pagetemplate`` which now contains ``namedtemplate``. 3.5.0 (2009-04-06) ------------------ - Use new ``zope.authentication`` instead of ``zope.app.security``. - Removed deprecated code and thus removed dependency on zope.deferredimport. - Removed old zpkg-related SETUP.cfg file. 3.4.2 (2009-01-27) ------------------ - Substitute zope.app.zapi by direct calls to its wrapped apis. See bug 219302. - Fixed author email and home page. 3.4.1 (2007-10-31) ------------------ - Resolve ``ZopeSecurityPolicy`` deprecation warning. 3.4.0 (2007-10-24) ------------------ - Initial release independent of the main Zope tree. zope.app.exception-3.6.3/PKG-INFO0000644000177100020040000001002211566460715017503 0ustar menesismenesis00000000000000Metadata-Version: 1.0 Name: zope.app.exception Version: 3.6.3 Summary: Zope 3 exception views Home-page: http://pypi.python.org/pypi/zope.app.exception Author: Zope Corporation and Contributors Author-email: zope-dev@zope.org License: ZPL 2.1 Description: This packages provides Zope 3 browser views for some generic exceptions. .. contents:: System Errors ============= System Errors are errors representing a system failure. At the application level, they are errors that are uncaught by the application and that a developer hasn't provided a custom error view for. Zope provides a default system error view that prints an obnoxius terse message and that sets the response status. There is a simple view registered in ``ftesting.zcml`` which raises ``Exception()``: >>> print http(r""" ... GET /error.html HTTP/1.1 ... """) HTTP/1.1 500 Internal Server Error ... A system error occurred. ... Another way of getting a system error is the occurrence of a system error, such as ``ComponentLookupError``. I have registered a simple view in ``ftesting.zcml``, too, that will raise a component lookup error. So if we call ``componentlookuperror.html``, we should get the error message: >>> print http(r""" ... GET /componentlookuperror.html HTTP/1.1 ... """) HTTP/1.1 500 Internal Server Error ... A system error occurred. ... CHANGES ======= 3.6.3 (2011-05-23) ------------------ - Replaced an undeclared test dependency on ``zope.app.authentication`` with ``zope.password``. 3.6.2 (2010-09-14) ------------------ - No longer depend on ``zope.app.zptpage`` for tests. - Replaced dependency on ``zope.app.securitypolicy`` by ``zope.securitypolicy``. 3.6.1 (2010-01-08) ------------------ - Require zope.browserpage which now contains ``namedtemplate``. - Fix ftesting.zcml due to ``zope.securitypolicy`` update. - Fix tests using a newer zope.publisher that requires zope.login. 3.6.0 (2009-05-18) ------------------ - ``ISystemErrorView`` interface has been moved to ``zope.browser.interfaces``, leaving BBB import here. - Cut dependency on ``zope.formlib`` by requiring newer version of ``zope.app.pagetemplate`` which now contains ``namedtemplate``. 3.5.0 (2009-04-06) ------------------ - Use new ``zope.authentication`` instead of ``zope.app.security``. - Removed deprecated code and thus removed dependency on zope.deferredimport. - Removed old zpkg-related SETUP.cfg file. 3.4.2 (2009-01-27) ------------------ - Substitute zope.app.zapi by direct calls to its wrapped apis. See bug 219302. - Fixed author email and home page. 3.4.1 (2007-10-31) ------------------ - Resolve ``ZopeSecurityPolicy`` deprecation warning. 3.4.0 (2007-10-24) ------------------ - Initial release independent of the main Zope tree. Keywords: zope3 exception view Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: Web Environment Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Zope Public License Classifier: Programming Language :: Python Classifier: Natural Language :: English Classifier: Operating System :: OS Independent Classifier: Topic :: Internet :: WWW/HTTP Classifier: Framework :: Zope3 zope.app.exception-3.6.3/README.txt0000644000177100020040000000011111566460705020101 0ustar menesismenesis00000000000000This packages provides Zope 3 browser views for some generic exceptions. zope.app.exception-3.6.3/setup.py0000644000177100020040000000560711566460705020134 0ustar menesismenesis00000000000000############################################################################## # # Copyright (c) 2006-2009 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. # ############################################################################## # This package is developed by the Zope Toolkit project, documented here: # http://docs.zope.org/zopetoolkit # When developing and releasing this package, please follow the documented # Zope Toolkit policies as described by this documentation. ############################################################################## """Setup for zope.app.exception package """ import os from setuptools import setup, find_packages def read(*rnames): return open(os.path.join(os.path.dirname(__file__), *rnames)).read() version = '3.6.3' setup(name='zope.app.exception', version=version, author='Zope Corporation and Contributors', author_email='zope-dev@zope.org', description='Zope 3 exception views', long_description=( read('README.txt') + '\n\n' + '.. contents::' + '\n\n' + read('src', 'zope', 'app', 'exception', 'browser', 'systemerror.txt') + '\n\n' + read('CHANGES.txt') ), keywords = "zope3 exception view", classifiers = [ 'Development Status :: 5 - Production/Stable', 'Environment :: Web Environment', 'Intended Audience :: Developers', 'License :: OSI Approved :: Zope Public License', 'Programming Language :: Python', 'Natural Language :: English', 'Operating System :: OS Independent', 'Topic :: Internet :: WWW/HTTP', 'Framework :: Zope3'], url='http://pypi.python.org/pypi/zope.app.exception', license='ZPL 2.1', packages=find_packages('src'), package_dir = {'': 'src'}, namespace_packages=['zope', 'zope.app'], extras_require=dict(test=[ 'zope.app.testing', 'zope.app.zcmlfiles', 'zope.login', 'zope.password', 'zope.securitypolicy', ]), install_requires=['setuptools', 'zope.interface', 'zope.publisher >= 3.12', 'zope.authentication', 'zope.browser>=1.2', 'zope.browserpage>=3.11.0', 'zope.component', 'zope.security', ], include_package_data = True, zip_safe = False, ) zope.app.exception-3.6.3/COPYRIGHT.txt0000644000177100020040000000004011566460705020515 0ustar menesismenesis00000000000000Zope Foundation and Contributorszope.app.exception-3.6.3/LICENSE.txt0000644000177100020040000000402611566460705020237 0ustar menesismenesis00000000000000Zope Public License (ZPL) Version 2.1 A copyright notice accompanies this license document that identifies the copyright holders. This license has been certified as open source. It has also been designated as GPL compatible by the Free Software Foundation (FSF). Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions in source code must retain the accompanying copyright notice, this list of conditions, and the following disclaimer. 2. Redistributions in binary form must reproduce the accompanying copyright notice, this list of conditions, and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Names of the copyright holders must not be used to endorse or promote products derived from this software without prior written permission from the copyright holders. 4. The right to distribute this software or to use it for any purpose does not give you the right to use Servicemarks (sm) or Trademarks (tm) of the copyright holders. Use of them is covered by separate agreement with the copyright holders. 5. If any files are modified, you must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. Disclaimer THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. zope.app.exception-3.6.3/bootstrap.py0000644000177100020040000000330211566460705020777 0ustar menesismenesis00000000000000############################################################################## # # Copyright (c) 2006 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. # ############################################################################## """Bootstrap a buildout-based project Simply run this script in a directory containing a buildout.cfg. The script accepts buildout command-line options, so you can use the -c option to specify an alternate configuration file. """ import os, shutil, sys, tempfile, urllib2 tmpeggs = tempfile.mkdtemp() ez = {} exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py' ).read() in ez ez['use_setuptools'](to_dir=tmpeggs, download_delay=0) import pkg_resources cmd = 'from setuptools.command.easy_install import main; main()' if sys.platform == 'win32': cmd = '"%s"' % cmd # work around spawn lamosity on windows ws = pkg_resources.working_set assert os.spawnle( os.P_WAIT, sys.executable, sys.executable, '-c', cmd, '-mqNxd', tmpeggs, 'zc.buildout', dict(os.environ, PYTHONPATH= ws.find(pkg_resources.Requirement.parse('setuptools')).location ), ) == 0 ws.add_entry(tmpeggs) ws.require('zc.buildout') import zc.buildout.buildout zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap']) shutil.rmtree(tmpeggs) zope.app.exception-3.6.3/setup.cfg0000644000177100020040000000007311566460715020234 0ustar menesismenesis00000000000000[egg_info] tag_build = tag_date = 0 tag_svn_revision = 0 zope.app.exception-3.6.3/src/0000755000177100020040000000000011566460715017202 5ustar menesismenesis00000000000000zope.app.exception-3.6.3/src/zope.app.exception.egg-info/0000755000177100020040000000000011566460715024425 5ustar menesismenesis00000000000000zope.app.exception-3.6.3/src/zope.app.exception.egg-info/PKG-INFO0000644000177100020040000001002211566460714025514 0ustar menesismenesis00000000000000Metadata-Version: 1.0 Name: zope.app.exception Version: 3.6.3 Summary: Zope 3 exception views Home-page: http://pypi.python.org/pypi/zope.app.exception Author: Zope Corporation and Contributors Author-email: zope-dev@zope.org License: ZPL 2.1 Description: This packages provides Zope 3 browser views for some generic exceptions. .. contents:: System Errors ============= System Errors are errors representing a system failure. At the application level, they are errors that are uncaught by the application and that a developer hasn't provided a custom error view for. Zope provides a default system error view that prints an obnoxius terse message and that sets the response status. There is a simple view registered in ``ftesting.zcml`` which raises ``Exception()``: >>> print http(r""" ... GET /error.html HTTP/1.1 ... """) HTTP/1.1 500 Internal Server Error ... A system error occurred. ... Another way of getting a system error is the occurrence of a system error, such as ``ComponentLookupError``. I have registered a simple view in ``ftesting.zcml``, too, that will raise a component lookup error. So if we call ``componentlookuperror.html``, we should get the error message: >>> print http(r""" ... GET /componentlookuperror.html HTTP/1.1 ... """) HTTP/1.1 500 Internal Server Error ... A system error occurred. ... CHANGES ======= 3.6.3 (2011-05-23) ------------------ - Replaced an undeclared test dependency on ``zope.app.authentication`` with ``zope.password``. 3.6.2 (2010-09-14) ------------------ - No longer depend on ``zope.app.zptpage`` for tests. - Replaced dependency on ``zope.app.securitypolicy`` by ``zope.securitypolicy``. 3.6.1 (2010-01-08) ------------------ - Require zope.browserpage which now contains ``namedtemplate``. - Fix ftesting.zcml due to ``zope.securitypolicy`` update. - Fix tests using a newer zope.publisher that requires zope.login. 3.6.0 (2009-05-18) ------------------ - ``ISystemErrorView`` interface has been moved to ``zope.browser.interfaces``, leaving BBB import here. - Cut dependency on ``zope.formlib`` by requiring newer version of ``zope.app.pagetemplate`` which now contains ``namedtemplate``. 3.5.0 (2009-04-06) ------------------ - Use new ``zope.authentication`` instead of ``zope.app.security``. - Removed deprecated code and thus removed dependency on zope.deferredimport. - Removed old zpkg-related SETUP.cfg file. 3.4.2 (2009-01-27) ------------------ - Substitute zope.app.zapi by direct calls to its wrapped apis. See bug 219302. - Fixed author email and home page. 3.4.1 (2007-10-31) ------------------ - Resolve ``ZopeSecurityPolicy`` deprecation warning. 3.4.0 (2007-10-24) ------------------ - Initial release independent of the main Zope tree. Keywords: zope3 exception view Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: Web Environment Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Zope Public License Classifier: Programming Language :: Python Classifier: Natural Language :: English Classifier: Operating System :: OS Independent Classifier: Topic :: Internet :: WWW/HTTP Classifier: Framework :: Zope3 zope.app.exception-3.6.3/src/zope.app.exception.egg-info/top_level.txt0000644000177100020040000000000511566460714027151 0ustar menesismenesis00000000000000zope zope.app.exception-3.6.3/src/zope.app.exception.egg-info/SOURCES.txt0000644000177100020040000000232511566460714026312 0ustar menesismenesis00000000000000CHANGES.txt COPYRIGHT.txt LICENSE.txt README.txt bootstrap.py buildout.cfg setup.py src/zope/__init__.py src/zope.app.exception.egg-info/PKG-INFO src/zope.app.exception.egg-info/SOURCES.txt src/zope.app.exception.egg-info/dependency_links.txt src/zope.app.exception.egg-info/namespace_packages.txt src/zope.app.exception.egg-info/not-zip-safe src/zope.app.exception.egg-info/requires.txt src/zope.app.exception.egg-info/top_level.txt src/zope/app/__init__.py src/zope/app/exception/__init__.py src/zope/app/exception/ftesting.zcml src/zope/app/exception/interfaces.py src/zope/app/exception/systemerror.py src/zope/app/exception/testing.py src/zope/app/exception/browser/__init__.py src/zope/app/exception/browser/configure.zcml src/zope/app/exception/browser/notfound.pt src/zope/app/exception/browser/notfound.py src/zope/app/exception/browser/systemerror.pt src/zope/app/exception/browser/systemerror.txt src/zope/app/exception/browser/unauthorized.pt src/zope/app/exception/browser/unauthorized.py src/zope/app/exception/browser/user.pt src/zope/app/exception/browser/user.py src/zope/app/exception/browser/tests/__init__.py src/zope/app/exception/browser/tests/test_error.py src/zope/app/exception/browser/tests/test_unauthorized.pyzope.app.exception-3.6.3/src/zope.app.exception.egg-info/namespace_packages.txt0000644000177100020040000000001611566460714030754 0ustar menesismenesis00000000000000zope zope.app zope.app.exception-3.6.3/src/zope.app.exception.egg-info/not-zip-safe0000644000177100020040000000000111566460706026653 0ustar menesismenesis00000000000000 zope.app.exception-3.6.3/src/zope.app.exception.egg-info/dependency_links.txt0000644000177100020040000000000111566460714030472 0ustar menesismenesis00000000000000 zope.app.exception-3.6.3/src/zope.app.exception.egg-info/requires.txt0000644000177100020040000000034511566460714027026 0ustar menesismenesis00000000000000setuptools zope.interface zope.publisher >= 3.12 zope.authentication zope.browser>=1.2 zope.browserpage>=3.11.0 zope.component zope.security [test] zope.app.testing zope.app.zcmlfiles zope.login zope.password zope.securitypolicyzope.app.exception-3.6.3/src/zope/0000755000177100020040000000000011566460715020157 5ustar menesismenesis00000000000000zope.app.exception-3.6.3/src/zope/__init__.py0000644000177100020040000000031111566460705022262 0ustar menesismenesis00000000000000# this is a namespace package try: import pkg_resources pkg_resources.declare_namespace(__name__) except ImportError: import pkgutil __path__ = pkgutil.extend_path(__path__, __name__) zope.app.exception-3.6.3/src/zope/app/0000755000177100020040000000000011566460715020737 5ustar menesismenesis00000000000000zope.app.exception-3.6.3/src/zope/app/__init__.py0000644000177100020040000000031111566460705023042 0ustar menesismenesis00000000000000# this is a namespace package try: import pkg_resources pkg_resources.declare_namespace(__name__) except ImportError: import pkgutil __path__ = pkgutil.extend_path(__path__, __name__) zope.app.exception-3.6.3/src/zope/app/exception/0000755000177100020040000000000011566460715022735 5ustar menesismenesis00000000000000zope.app.exception-3.6.3/src/zope/app/exception/testing.py0000644000177100020040000000163011566460705024763 0ustar menesismenesis00000000000000############################################################################## # # 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. # ############################################################################## """zope.app.exception common test related classes/functions/objects.""" import os from zope.app.testing.functional import ZCMLLayer AppExceptionLayer = ZCMLLayer( os.path.join(os.path.split(__file__)[0], 'ftesting.zcml'), __name__, 'AppExceptionLayer', allow_teardown=True) zope.app.exception-3.6.3/src/zope/app/exception/systemerror.py0000644000177100020040000000154211566460705025706 0ustar menesismenesis00000000000000############################################################################## # # Copyright (c) 2004 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. # ############################################################################## """System error indicator""" import zope.interface import zope.browser.interfaces class SystemErrorView: zope.interface.implements(zope.browser.interfaces.ISystemErrorView) def isSystemError(self): return True zope.app.exception-3.6.3/src/zope/app/exception/__init__.py0000644000177100020040000000001711566460705025043 0ustar menesismenesis00000000000000# Import this! zope.app.exception-3.6.3/src/zope/app/exception/interfaces.py0000644000177100020040000000131511566460705025431 0ustar menesismenesis00000000000000############################################################################## # Copyright (c) 2003 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. ############################################################################## """General exceptions""" # BBB from zope.browser.interfaces import ISystemErrorView zope.app.exception-3.6.3/src/zope/app/exception/ftesting.zcml0000644000177100020040000000324111566460705025446 0ustar menesismenesis00000000000000 zope.app.exception-3.6.3/src/zope/app/exception/browser/0000755000177100020040000000000011566460715024420 5ustar menesismenesis00000000000000zope.app.exception-3.6.3/src/zope/app/exception/browser/notfound.pt0000644000177100020040000000071711566460705026625 0ustar menesismenesis00000000000000

The page that you are trying to access is not available


Please note the following:
  1. You might have misspelled the url
  2. You might be trying to access a non-existing page
zope.app.exception-3.6.3/src/zope/app/exception/browser/user.py0000644000177100020040000000137711566460705025757 0ustar menesismenesis00000000000000############################################################################## # Copyright (c) 2003 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. ############################################################################## """Support for user views""" class UserErrorView(object): def title(self): return self.context.__class__.__name__ zope.app.exception-3.6.3/src/zope/app/exception/browser/__init__.py0000644000177100020040000000007711566460705026534 0ustar menesismenesis00000000000000# empty __init__.py file to make this directory into a package zope.app.exception-3.6.3/src/zope/app/exception/browser/systemerror.txt0000644000177100020040000000177311566460705027566 0ustar menesismenesis00000000000000System Errors ============= System Errors are errors representing a system failure. At the application level, they are errors that are uncaught by the application and that a developer hasn't provided a custom error view for. Zope provides a default system error view that prints an obnoxius terse message and that sets the response status. There is a simple view registered in ``ftesting.zcml`` which raises ``Exception()``: >>> print http(r""" ... GET /error.html HTTP/1.1 ... """) HTTP/1.1 500 Internal Server Error ... A system error occurred. ... Another way of getting a system error is the occurrence of a system error, such as ``ComponentLookupError``. I have registered a simple view in ``ftesting.zcml``, too, that will raise a component lookup error. So if we call ``componentlookuperror.html``, we should get the error message: >>> print http(r""" ... GET /componentlookuperror.html HTTP/1.1 ... """) HTTP/1.1 500 Internal Server Error ... A system error occurred. ... zope.app.exception-3.6.3/src/zope/app/exception/browser/unauthorized.py0000644000177100020040000000347611566460705027524 0ustar menesismenesis00000000000000############################################################################## # # Copyright (c) 2003 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. # ############################################################################## """Unauthorized Exception View Class""" from zope.authentication.interfaces import IAuthentication from zope.publisher.browser import BrowserPage from zope.browserpage import namedtemplate from zope.component import getUtility from zope.browserpage import ViewPageTemplateFile class Unauthorized(BrowserPage): def __call__(self): # Set the error status to 403 (Forbidden) in the case when we don't # challenge the user self.request.response.setStatus(403) # make sure that squid does not keep the response in the cache self.request.response.setHeader('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT') self.request.response.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate') self.request.response.setHeader('Pragma', 'no-cache') principal = self.request.principal auth = getUtility(IAuthentication) auth.unauthorized(principal.id, self.request) if self.request.response.getStatus() not in (302, 303): return self.template() template = namedtemplate.NamedTemplate('default') default_template = namedtemplate.NamedTemplateImplementation( ViewPageTemplateFile('unauthorized.pt'), Unauthorized) zope.app.exception-3.6.3/src/zope/app/exception/browser/unauthorized.pt0000644000177100020040000000037111566460705027506 0ustar menesismenesis00000000000000

Unauthorized

You are not authorized

zope.app.exception-3.6.3/src/zope/app/exception/browser/configure.zcml0000644000177100020040000000165511566460705027276 0ustar menesismenesis00000000000000 zope.app.exception-3.6.3/src/zope/app/exception/browser/tests/0000755000177100020040000000000011566460715025562 5ustar menesismenesis00000000000000zope.app.exception-3.6.3/src/zope/app/exception/browser/tests/test_error.py0000644000177100020040000000332211566460705030323 0ustar menesismenesis00000000000000############################################################################## # # Copyright (c) 2004 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. # ############################################################################## """Functional tests for NotFoundError """ import unittest from zope.app.testing import functional from zope.component.interfaces import ComponentLookupError from zope.app.exception.testing import AppExceptionLayer class RaiseError(object): def __call__(self): raise Exception() class RaiseComponentLookupError(object): def __call__(self): raise ComponentLookupError() class TestComponentLookupError(functional.BrowserTestCase): def testComponentLookupError(self): response = self.publish('/foobar', basic='mgr:mgrpw', handle_errors=True) self.assertEqual(response.getStatus(), 404) body = response.getBody() self.assert_( 'The page that you are trying to access is not available' in body) def test_suite(): TestComponentLookupError.layer = AppExceptionLayer systemerror = functional.FunctionalDocFileSuite('../systemerror.txt') systemerror.layer = AppExceptionLayer return unittest.TestSuite(( unittest.makeSuite(TestComponentLookupError), systemerror, )) zope.app.exception-3.6.3/src/zope/app/exception/browser/tests/__init__.py0000644000177100020040000000007711566460705027676 0ustar menesismenesis00000000000000# empty __init__.py file to make this directory into a package zope.app.exception-3.6.3/src/zope/app/exception/browser/tests/test_unauthorized.py0000644000177100020040000000774611566460705031731 0ustar menesismenesis00000000000000############################################################################## # # Copyright (c) 2001-2009 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. # ############################################################################## """Test Unauthorized Exception Views""" from unittest import TestCase, main, makeSuite from zope import component, interface import zope.browserpage.namedtemplate from zope.publisher.browser import TestRequest from zope.authentication.interfaces import IAuthentication from zope.security.interfaces import IPrincipal from zope.app.testing import ztapi from zope.app.exception.browser.unauthorized import Unauthorized from zope.app.testing.placelesssetup import PlacelessSetup class DummyPrincipal(object): interface.implements(IPrincipal) # this is a lie def __init__(self, id): self.id = id def getId(self): return self.id class DummyAuthUtility(object): interface.implements(IAuthentication) # this is a lie status = None def unauthorized(self, principal_id, request): self.principal_id = principal_id self.request = request if self.status is not None: self.request.response.setStatus(self.status) class DummyTemplate(object): def __init__(self, context): self.context = context component.adapts(Unauthorized) interface.implements(zope.browserpage.namedtemplate.INamedTemplate) def __call__(self): return 'You are not authorized' class Test(PlacelessSetup, TestCase): def setUp(self): super(Test, self).setUp() self.auth = DummyAuthUtility() ztapi.provideUtility(IAuthentication, self.auth) def tearDown(self): super(Test, self).tearDown() def testUnauthorized(self): component.provideAdapter(DummyTemplate, name="default") exception = Exception() try: raise exception except: pass request = TestRequest() request.setPrincipal(DummyPrincipal(23)) u = Unauthorized(exception, request) res = u() # Make sure that we rendered the expected template self.assertEqual("You are not authorized", res) # Make sure the response status was set self.assertEqual(request.response.getStatus(), 403) # check headers that work around squid "negative_ttl" self.assertEqual(request.response.getHeader('Expires'), 'Mon, 26 Jul 1997 05:00:00 GMT') self.assertEqual(request.response.getHeader('Pragma'), 'no-cache') self.assertEqual(request.response.getHeader('Cache-Control'), 'no-store, no-cache, must-revalidate') # Make sure the auth utility was called self.failUnless(self.auth.request is request) self.assertEqual(self.auth.principal_id, 23) def testRedirect(self): exception= Exception() try: raise exception except: pass request = TestRequest() request.setPrincipal(DummyPrincipal(23)) u = Unauthorized(exception, request) self.auth.status = 303 res = u() # Make sure that the template was not rendered self.assert_(res is None) # Make sure the auth's redirect is honored self.assertEqual(request.response.getStatus(), 303) # Make sure the auth utility was called self.failUnless(self.auth.request is request) self.assertEqual(self.auth.principal_id, 23) def test_suite(): return makeSuite(Test) if __name__=='__main__': main(defaultTest='test_suite') zope.app.exception-3.6.3/src/zope/app/exception/browser/notfound.py0000644000177100020040000000166211566460705026632 0ustar menesismenesis00000000000000############################################################################## # # Copyright (c) 2004 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. # ############################################################################## """NotFound Error View class. """ __docformat__ = 'restructuredtext' class NotFound(object): """`NotFound` Error View `NotFound` errors should return 404 instead of 200. """ def __call__(self, *args, **kw): self.request.response.setStatus(404) return self.index(*args, **kw) zope.app.exception-3.6.3/src/zope/app/exception/browser/user.pt0000644000177100020040000000037511566460705025747 0ustar menesismenesis00000000000000
zope.app.exception-3.6.3/src/zope/app/exception/browser/systemerror.pt0000644000177100020040000000031311566460705027357 0ustar menesismenesis00000000000000System Error A system error occurred. zope.app.exception-3.6.3/buildout.cfg0000644000177100020040000000053111566460705020721 0ustar menesismenesis00000000000000[buildout] develop = . parts = test coverage-test coverage-report [test] recipe = zc.recipe.testrunner eggs = zope.app.exception [test] [coverage-test] recipe = zc.recipe.testrunner eggs = ${test:eggs} defaults = ['--coverage', '../../coverage'] [coverage-report] recipe = zc.recipe.egg eggs = z3c.coverage scripts = coverage=coverage-report