[Checkins] SVN: z3c.layer.trusted/trunk/ Copy z3c.layer.minimal
from zope.layer ot it's own top level namespace folder
Roger Ineichen
roger at projekt01.ch
Fri Dec 28 19:55:46 EST 2007
Log message for revision 82519:
Copy z3c.layer.minimal from zope.layer ot it's own top level namespace folder
Update README.txt and CHANGES.txt
Added unreleased z3c.layer.minimal package as externals
Changed:
A z3c.layer.trusted/trunk/CHANGES.txt
A z3c.layer.trusted/trunk/README.txt
A z3c.layer.trusted/trunk/bootstrap.py
A z3c.layer.trusted/trunk/buildout.cfg
_U z3c.layer.trusted/trunk/externals/
A z3c.layer.trusted/trunk/setup.py
A z3c.layer.trusted/trunk/src/z3c/layer/trusted/README.txt
A z3c.layer.trusted/trunk/src/z3c/layer/trusted/SETUP.cfg
A z3c.layer.trusted/trunk/src/z3c/layer/trusted/__init__.py
A z3c.layer.trusted/trunk/src/z3c/layer/trusted/configure.zcml
A z3c.layer.trusted/trunk/src/z3c/layer/trusted/ftesting.zcml
A z3c.layer.trusted/trunk/src/z3c/layer/trusted/tests.py
A z3c.layer.trusted/trunk/src/z3c/layer/trusted/z3c.layer.trusted-configure.zcml
A z3c.layer.trusted/trunk/src/z3c/layer/trusted/zope.traversing.browser.zcml
-=-
Added: z3c.layer.trusted/trunk/CHANGES.txt
===================================================================
--- z3c.layer.trusted/trunk/CHANGES.txt (rev 0)
+++ z3c.layer.trusted/trunk/CHANGES.txt 2007-12-29 00:55:45 UTC (rev 82519)
@@ -0,0 +1,44 @@
+=======
+CHANGES
+=======
+
+1.0.0dev (unreleased)
+---------------------
+
+- move z3c.layer.trusted package to it's own top level package
+ form zope.layer to z3c.layer.trusted
+
+- Reflect changes in zope.app.securitypolicy zcml configuration. Prevent
+ loading deprecated module configuration
+
+CHANGES taken form old z3c.layer top level package
+
+0.2.3 (2007-11-07)
+------------------
+
+- Forward-Bug: Due to a bug in mechanize, the testbrowser throws
+ ``httperror_seek_wrapper`` instead of ``HTTPError`` errors. Thanks to RE
+ normalizers, the code will now work whether the bug is fixed or not in
+ mechanize.
+
+
+0.2.2 (2007-10-31)
+------------------
+
+- Fixed package meta-data.
+
+- Bug: Fixed test failures due to depency updates.
+
+- Restructure: Fixed deprecation warninf for ``ZopeSecurityPolicy``.
+
+
+0.2.1 (2007-??-??)
+------------------
+
+- Changes unknown.
+
+
+0.2.0 (2007-??-??)
+------------------
+
+- Initial release.
Property changes on: z3c.layer.trusted/trunk/CHANGES.txt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: z3c.layer.trusted/trunk/README.txt
===================================================================
--- z3c.layer.trusted/trunk/README.txt (rev 0)
+++ z3c.layer.trusted/trunk/README.txt 2007-12-29 00:55:45 UTC (rev 82519)
@@ -0,0 +1,5 @@
+This package provides a trused layer setup for Zope3. Truted means you can
+travers over objects which you don't have permission for. This is needed if you
+have a setup with more then one IAuthentication utility. Otherwise you don't
+hav a chance to traverse to the IAthentication utility in the subsite without
+to authenticate at the parent IAuthentication.
Property changes on: z3c.layer.trusted/trunk/README.txt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: z3c.layer.trusted/trunk/bootstrap.py
===================================================================
--- z3c.layer.trusted/trunk/bootstrap.py (rev 0)
+++ z3c.layer.trusted/trunk/bootstrap.py 2007-12-29 00:55:45 UTC (rev 82519)
@@ -0,0 +1,52 @@
+##############################################################################
+#
+# Copyright (c) 2006 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.
+#
+##############################################################################
+"""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.
+
+$Id: bootstrap.py 35779 2007-03-22 16:08:07Z batlogg $
+"""
+
+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)
Property changes on: z3c.layer.trusted/trunk/bootstrap.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: z3c.layer.trusted/trunk/buildout.cfg
===================================================================
--- z3c.layer.trusted/trunk/buildout.cfg (rev 0)
+++ z3c.layer.trusted/trunk/buildout.cfg 2007-12-29 00:55:45 UTC (rev 82519)
@@ -0,0 +1,16 @@
+[buildout]
+develop = .
+ externals/z3c.layer.minimal
+parts = test checker coverage
+
+[test]
+recipe = zc.recipe.testrunner
+eggs = z3c.layer.trusted [test]
+
+[checker]
+recipe = lovely.recipe:importchecker
+path = src/z3c/layer/trusted
+
+[coverage]
+recipe = zc.recipe.egg
+eggs = z3c.coverage
Property changes on: z3c.layer.trusted/trunk/externals
___________________________________________________________________
Name: svn:externals
+ z3c.layer.minimal svn+ssh://svn.zope.org/repos/main/z3c.layer.minimal/trunk
Added: z3c.layer.trusted/trunk/setup.py
===================================================================
--- z3c.layer.trusted/trunk/setup.py (rev 0)
+++ z3c.layer.trusted/trunk/setup.py 2007-12-29 00:55:45 UTC (rev 82519)
@@ -0,0 +1,69 @@
+#!python
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+"""Setup
+
+$Id:$
+"""
+
+import os
+from setuptools import setup, find_packages
+
+def read(*rnames):
+ return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
+
+setup(
+ name = 'z3c.layer.trusted',
+ version = '1.0.0dev',
+ author='Zope Foundation and Contributors',
+ author_email='zope3-dev at zope.org',
+ description = "Trusted layer setup for Zope3",
+ long_description=(
+ read('README.txt')
+ + '\n\n' +
+ read('CHANGES.txt')
+ ),
+ keywords = "z3c trusted layer zope zope3",
+ 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://cheeseshop.python.org/pypi/z3c.layer.trusted',
+ license='ZPL 2.1',
+ packages = find_packages('src'),
+ include_package_data = True,
+ package_dir = {'':'src'},
+ namespace_packages = ['z3c'],
+ extras_require = dict(
+ test = [
+ 'zope.testbrowser',
+ ],
+ ),
+ install_requires = [
+ 'setuptools',
+ 'zope.configuration',
+ 'zope.traversing',
+ 'zope.app.http',
+ 'zope.app.publisher',
+ 'z3c.layer.minimal',
+ ],
+ zip_safe = False,
+)
+
Property changes on: z3c.layer.trusted/trunk/setup.py
___________________________________________________________________
Name: svn:eol-style
+ native
Copied: z3c.layer.trusted/trunk/src/z3c/layer/trusted/README.txt (from rev 82507, z3c.layer/trunk/src/z3c/layer/trusted/README.txt)
===================================================================
--- z3c.layer.trusted/trunk/src/z3c/layer/trusted/README.txt (rev 0)
+++ z3c.layer.trusted/trunk/src/z3c/layer/trusted/README.txt 2007-12-29 00:55:45 UTC (rev 82519)
@@ -0,0 +1,167 @@
+======
+README
+======
+
+This package contains the trusted layer. This layer support a correct set of
+component registration and can be used for inheritation in custom skins.
+
+The ITrustedBrowserLayer supports the same registration set like the
+IMinimalBrowserLayer. The only difference is, that the trusted layer offers
+trusted traversal adapters. This means a skin using this layer can traverse
+over a PAU (pluggable IAuthentication utility) without to run into a
+Unautorized exception.
+
+For more information see also the README.txt in z3c.layer.minimal.
+
+
+Testing
+-------
+
+For testing the ITrustedBrowserLayer we use the testing skin defined in the
+tests package which uses the ITrustedBrowserLayer. This means, that our
+testing skin provides also the views defined in the minimal package
+and it's testing views defined in the minimal tests.
+
+Login as manager first:
+
+ >>> from zope.testbrowser.testing import Browser
+ >>> manager = Browser()
+ >>> manager.addHeader('Authorization', 'Basic mgr:mgrpw')
+
+Check if we can access the public page.html view which is registred in the
+ftesting.zcml file with our skin:
+
+ >>> skinURL = 'http://localhost/++skin++TrustedTesting'
+ >>> manager.open(skinURL + '/page.html')
+ >>> manager.url
+ 'http://localhost/++skin++TrustedTesting/page.html'
+
+ >>> print manager.contents
+ <BLANKLINE>
+ <html>
+ <head>
+ <title>testing</title>
+ </head>
+ <body>
+ <BLANKLINE>
+ test page
+ <BLANKLINE>
+ </body>
+ </html>
+ <BLANKLINE>
+ <BLANKLINE>
+
+Now check the not found page which is a exception view on the exception
+``zope.publisher.interfaces.INotFound``:
+
+ >>> manager.open(skinURL + '/foobar.html')
+ Traceback (most recent call last):
+ ...
+ HTTPError: HTTP Error 404: Not Found
+
+ >>> print manager.contents
+ <BLANKLINE>
+ <html>
+ <head>
+ <title>testing</title>
+ </head>
+ <body>
+ <div>
+ <br />
+ <br />
+ <h3>
+ The page you are trying to access is not available
+ </h3>
+ <br />
+ <b>
+ Please try the following:
+ </b>
+ <br />
+ <ol>
+ <li>
+ Make sure that the Web site address is spelled correctly.
+ </li>
+ <li>
+ <a href="javascript:history.back(1);">
+ Go back and try another URL.
+ </a>
+ </li>
+ </ol>
+ </div>
+ </body>
+ </html>
+ <BLANKLINE>
+ <BLANKLINE>
+
+And check the user error page which is a view registred for
+``zope.exceptions.interfaces.IUserError`` exceptions:
+
+ >>> manager.open(skinURL + '/@@usererror.html')
+ >>> print manager.contents
+ <BLANKLINE>
+ <html>
+ <head>
+ <title>testing</title>
+ </head>
+ <body>
+ <div>
+ <div>simply user error</div>
+ </div>
+ </body>
+ </html>
+ <BLANKLINE>
+ <BLANKLINE>
+
+And check error view registred for
+``zope.interface.common.interfaces.IException``:
+
+ >>> manager.open(skinURL + '/@@systemerror.html')
+ >>> print manager.contents
+ <BLANKLINE>
+ <html>
+ <head>
+ <title>testing</title>
+ </head>
+ <body>
+ <div>
+ <br />
+ <br />
+ <h3>A system error occurred</h3>
+ <br />
+ <b>Please contact the administrator.</b>
+ <a href="javascript:history.back(1);">
+ Go back and try another URL.
+ </a>
+ </div>
+ </body>
+ </html>
+ <BLANKLINE>
+ <BLANKLINE>
+
+And check the ``zope.security.interfaces.IUnauthorized`` view, use a new
+unregistred user (test browser) for this:
+
+ >>> unauthorized = Browser()
+ >>> unauthorized.open(skinURL + '/@@forbidden.html')
+ Traceback (most recent call last):
+ ...
+ HTTPError: HTTP Error 401: Unauthorized
+
+ >>> print unauthorized.contents
+ <BLANKLINE>
+ <html>
+ <head>
+ <title>testing</title>
+ </head>
+ <body>
+ <div>
+ <BLANKLINE>
+ <h1>Unauthorized</h1>
+ <BLANKLINE>
+ <p>You are not authorized</p>
+ <BLANKLINE>
+ </div>
+ </body>
+ </html>
+ <BLANKLINE>
+ <BLANKLINE>
Copied: z3c.layer.trusted/trunk/src/z3c/layer/trusted/SETUP.cfg (from rev 82507, z3c.layer/trunk/src/z3c/layer/trusted/SETUP.cfg)
===================================================================
--- z3c.layer.trusted/trunk/src/z3c/layer/trusted/SETUP.cfg (rev 0)
+++ z3c.layer.trusted/trunk/src/z3c/layer/trusted/SETUP.cfg 2007-12-29 00:55:45 UTC (rev 82519)
@@ -0,0 +1,3 @@
+<data-files zopeskel/etc/package-includes>
+ z3c.layer.trusted-*.zcml
+</data-files>
Copied: z3c.layer.trusted/trunk/src/z3c/layer/trusted/__init__.py (from rev 82507, z3c.layer/trunk/src/z3c/layer/trusted/__init__.py)
===================================================================
--- z3c.layer.trusted/trunk/src/z3c/layer/trusted/__init__.py (rev 0)
+++ z3c.layer.trusted/trunk/src/z3c/layer/trusted/__init__.py 2007-12-29 00:55:45 UTC (rev 82519)
@@ -0,0 +1,22 @@
+##############################################################################
+#
+# Copyright (c) 2005 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$
+"""
+
+from z3c.layer import minimal
+
+
+class ITrustedBrowserLayer(minimal.IMinimalBrowserLayer):
+ """Like IMinimalBrowserLayer but with trusted traverser."""
Copied: z3c.layer.trusted/trunk/src/z3c/layer/trusted/configure.zcml (from rev 82507, z3c.layer/trunk/src/z3c/layer/trusted/configure.zcml)
===================================================================
--- z3c.layer.trusted/trunk/src/z3c/layer/trusted/configure.zcml (rev 0)
+++ z3c.layer.trusted/trunk/src/z3c/layer/trusted/configure.zcml 2007-12-29 00:55:45 UTC (rev 82519)
@@ -0,0 +1,12 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:browser="http://namespaces.zope.org/browser">
+
+ <interface
+ interface="z3c.layer.trusted.ITrustedBrowserLayer"
+ type="zope.publisher.interfaces.browser.IBrowserSkinType"
+ />
+
+ <include file="zope.traversing.browser.zcml" />
+
+</configure>
Copied: z3c.layer.trusted/trunk/src/z3c/layer/trusted/ftesting.zcml (from rev 82507, z3c.layer/trunk/src/z3c/layer/trusted/ftesting.zcml)
===================================================================
--- z3c.layer.trusted/trunk/src/z3c/layer/trusted/ftesting.zcml (rev 0)
+++ z3c.layer.trusted/trunk/src/z3c/layer/trusted/ftesting.zcml 2007-12-29 00:55:45 UTC (rev 82519)
@@ -0,0 +1,17 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:meta="http://namespaces.zope.org/meta"
+ xmlns:browser="http://namespaces.zope.org/browser"
+ i18n_domain="zope"
+ package="z3c.layer.trusted">
+
+ <include package="z3c.layer.minimal.tests" file="ftesting.zcml"/>
+ <include package="z3c.layer.trusted" />
+
+ <interface
+ interface="z3c.layer.trusted.tests.ITrustedTestingSkin"
+ type="zope.publisher.interfaces.browser.IBrowserSkinType"
+ name="TrustedTesting"
+ />
+
+</configure>
Copied: z3c.layer.trusted/trunk/src/z3c/layer/trusted/tests.py (from rev 82507, z3c.layer/trunk/src/z3c/layer/trusted/tests.py)
===================================================================
--- z3c.layer.trusted/trunk/src/z3c/layer/trusted/tests.py (rev 0)
+++ z3c.layer.trusted/trunk/src/z3c/layer/trusted/tests.py 2007-12-29 00:55:45 UTC (rev 82519)
@@ -0,0 +1,51 @@
+##############################################################################
+#
+# Copyright (c) 2005 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$
+"""
+import re
+import unittest
+from zope.testing import renormalizing
+from zope.app.testing import functional
+
+from z3c.layer import trusted
+
+layer = functional.defineLayer('TestLayer', 'ftesting.zcml')
+
+
+class ITrustedTestingSkin(trusted.ITrustedBrowserLayer):
+ """The ITrustedBrowserLayer testing skin."""
+
+
+def getRootFolder():
+ return functional.FunctionalTestSetup().getRootFolder()
+
+
+def test_suite():
+ suite = unittest.TestSuite()
+
+ s = functional.FunctionalDocFileSuite(
+ 'README.txt',
+ globs={'getRootFolder': getRootFolder},
+ checker = renormalizing.RENormalizing([
+ (re.compile(r'httperror_seek_wrapper:', re.M), 'HTTPError:'),
+ ])
+ )
+ s.layer = TestLayer
+ suite.addTest(s)
+
+ return suite
+
+if __name__ == '__main__':
+ unittest.main(defaultTest='test_suite')
Copied: z3c.layer.trusted/trunk/src/z3c/layer/trusted/z3c.layer.trusted-configure.zcml (from rev 82507, z3c.layer/trunk/src/z3c/layer/trusted/z3c.layer.trusted-configure.zcml)
===================================================================
--- z3c.layer.trusted/trunk/src/z3c/layer/trusted/z3c.layer.trusted-configure.zcml (rev 0)
+++ z3c.layer.trusted/trunk/src/z3c/layer/trusted/z3c.layer.trusted-configure.zcml 2007-12-29 00:55:45 UTC (rev 82519)
@@ -0,0 +1 @@
+<include package="z3c.layer.trusted" />
Copied: z3c.layer.trusted/trunk/src/z3c/layer/trusted/zope.traversing.browser.zcml (from rev 82507, z3c.layer/trunk/src/z3c/layer/trusted/zope.traversing.browser.zcml)
===================================================================
--- z3c.layer.trusted/trunk/src/z3c/layer/trusted/zope.traversing.browser.zcml (rev 0)
+++ z3c.layer.trusted/trunk/src/z3c/layer/trusted/zope.traversing.browser.zcml 2007-12-29 00:55:45 UTC (rev 82519)
@@ -0,0 +1,33 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:browser="http://namespaces.zope.org/browser"
+ i18n_domain="z3c">
+
+ <adapter
+ for="zope.interface.Interface
+ z3c.layer.trusted.ITrustedBrowserLayer"
+ provides="zope.publisher.interfaces.browser.IBrowserPublisher"
+ factory="zope.app.publication.traversers.SimpleComponentTraverser"
+ permission="zope.Public"
+ trusted="True"
+ />
+
+ <adapter
+ for="zope.app.container.interfaces.IItemContainer
+ z3c.layer.trusted.ITrustedBrowserLayer"
+ provides="zope.publisher.interfaces.browser.IBrowserPublisher"
+ factory="zope.app.container.traversal.ItemTraverser"
+ permission="zope.Public"
+ trusted="True"
+ />
+
+ <adapter
+ for="zope.app.container.interfaces.ISimpleReadContainer
+ z3c.layer.trusted.ITrustedBrowserLayer"
+ provides="zope.publisher.interfaces.browser.IBrowserPublisher"
+ factory="zope.app.container.traversal.ItemTraverser"
+ permission="zope.Public"
+ trusted="True"
+ />
+
+</configure>
More information about the Checkins
mailing list