Metadata-Version: 1.0
Name: z3c.layer
Version: 0.3.0
Summary: Collection of Alternative Base Layers
Home-page: http://pypi.python.org/pypi/z3c.layer
Author: Zope Corporation and Contributors
Author-email: zope-dev@zope.org
License: ZPL 2.1
Description: A package for some useful base layers.
        
        
        .. contents::
        
        =============
        Minimal layer
        =============
        
        This package contains the minimal layer. This layer supports a correct set of
        component registration and can be used for inheritation in custom skins.
        
        Right now the default implementation in Zope3 has different restriction in the
        traversal concept and use to much registration on the default layer.
        
        
        IMinimalBrowserLayer
        --------------------
        
        The minimal layer is useful for build custom presentation skins without access
        to ZMI menus like zmi_views etc. This means there is no menu item registred if
        you use this layer.
        
        This layer is NOT derived from IDefaultBrowserLayer. Therefore it provides
        only a minimal set of the most important public views such as @@absolute_url.
        The following packages are accounted:
        
        - zope.app.http.exception
        - zope.app.publication
        - zope.app.publisher.browser
        - zope.app.traversing
        - zope.app.traversing.browser
        
        
        Testing
        -------
        
        For testing the IMinimalBrowserLayer we use the testing skin defined in the
        tests package which uses the IMinimalBrowserLayer as the only base layer.
        This means, that our testing skin provides only the views defined in the
        minimal package and it's testing views defined in 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 page.html view which is registred in the
        ftesting.zcml file with our skin:
        
        >>> manager = Browser()
        >>> manager.addHeader('Authorization', 'Basic mgr:mgrpw')
        >>> skinURL = 'http://localhost/++skin++MinimalTesting'
        >>> manager.open(skinURL + '/page.html')
        >>> manager.url
        'http://localhost/++skin++MinimalTesting/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>
        
        
        =============
        Pagelet layer
        =============
        
        This package contains the pagelet layer. This layer supports a correct set of
        component registration and can be used for inheritation in custom skins.
        
        Right now the default implementation in Zope3 has different restriction in the
        traversal concept and use to much registration on the default layer.
        
        Important
        ---------
        
        This layer supports the z3c.pagelet pattern. this means every page e.g. the
        error page is based on the z3c.pagelet concept.
        
        
        IPageletBrowserLayer
        --------------------
        
        The pagelet layer is useful for build custom presentation skins without access
        to ZMI menus like zmi_views etc. This means there is no menu item registred if
        you use this layer.
        
        This layer is NOT derived from IDefaultBrowserLayer. Therefore it provides
        only a minimal set of the most important public views such as @@absolute_url.
        The following packages are accounted:
        
        - zope.app.http.exception
        - zope.app.publication
        - zope.app.publisher.browser
        - zope.app.traversing
        - zope.app.traversing.browser
        
        
        Testing
        -------
        
        For testing the IPageletBrowserLayer we use the testing skin defined in the
        tests package which uses the IPageletBrowserLayer as the only base layer.
        This means, that our testing skin provides only the views defined in the
        minimal package and it's testing views defined in 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 page.html view which is registred in the
        ftesting.zcml file with our skin:
        
        >>> manager = Browser()
        >>> manager.addHeader('Authorization', 'Basic mgr:mgrpw')
        >>> skinURL = 'http://localhost/++skin++MinimalTesting'
        >>> manager.open(skinURL + '/page.html')
        >>> manager.url
        'http://localhost/++skin++MinimalTesting/page.html'
        
        >>> print manager.contents
        <!DOCTYPE...
        <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
        <head>
        <title>TestingSkin</title>
        </head>
        <body>
        test page
        <BLANKLINE>
        </body>
        </html>
        <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
        <!DOCTYPE...
        <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
        <head>
        <title>TestingSkin</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>
        <BLANKLINE>
        </body>
        </html>
        <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
        <!DOCTYPE...
        <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
        <head>
        <title>TestingSkin</title>
        </head>
        <body>
        <div>
        <div>simply user error</div>
        </div>
        <BLANKLINE>
        </body>
        </html>
        <BLANKLINE>
        
        And check error view registred for
        ``zope.interface.common.interfaces.IException``:
        
        >>> manager.open(skinURL + '/@@systemerror.html')
        >>> print manager.contents
        <!DOCTYPE...
        <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
        <head>
        <title>TestingSkin</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>
        <BLANKLINE>
        </body>
        </html>
        <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
        <!DOCTYPE...
        <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
        <head>
        <title>TestingSkin</title>
        </head>
        <body>
        <div>
        <br />
        <br />
        <h3>Unauthorized</h3>
        <br />
        <b>You are not authorized.</b>
        </div>
        <BLANKLINE>
        </body>
        </html>
        <BLANKLINE>
        
        
        =============
        Trusted layer
        =============
        
        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. (`Minimal Layer`_)
        
        
        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>
        
        
        =======
        CHANGES
        =======
        
        0.3.0 (2009-02-07)
        ------------------
        
        - Replaced ``zope.app.zapi`` by the original imports.
        
        - Replaced ``zope.app.container`` by ``zope.container``.
        
        - Fixed deprecation warning about importing ``ISite`` from
        ``zope.app.component.interfaces``.
        
        - Declared ``zope.app.zcmlfiles`` as testing dependency, as otherwise
        tests break.
        
        - Fixed home page and email address.
        
        - Added README files of layers to long description.
        
        
        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.
        
Keywords: zope3 layer
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
