Pagelet layer setup for Zope3
Project description
This package provides a pagelet based layer setup for Zope3.
Pagelet-based Layer for Zope 3
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 ia based on the pagelet pattern. This means every page e.g. the error page is based on the pagelet concept.
IPageletBrowserLayer Layer
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 layer. Therefore it provides only a minimal set of the most important public views such as @@absolute_url which get registered in zope packages for the IHTTPRequest and IBrowserRequest. Next to this views, this package will only provide error views and traversers which are normaly regsitered in the following zope packages:
zope.app.http.exception
zope.app.publication
zope.browserresource
zope.traversing
Note, this package does not depend on all the packages described above. We only need to depend on the same interfaces where this package will define views and traversers for.
Testing
For testing the IPageletBrowserLayer layer we use the testing skin defined in the tests package which uses the IPageletBrowserLayer layer 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()
Check if we can access the page.html view which is registred in the ftesting.zcml file with our skin:
>>> skinURL = 'http://localhost/++skin++PageletTestSkin' >>> manager.open(skinURL + '/page.html') >>> manager.url 'http://localhost/++skin++PageletTestSkin/page.html'>>> print manager.contents <!DOCTYPE... <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>PageletTestLayout</title> </head> <body> test page <BLANKLINE> </body> </html> <BLANKLINE>
Not Found
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_seek_wrapper: HTTP Error 404: Not Found>>> print manager.contents <!DOCTYPE... <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>PageletTestLayout</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>
User error
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>PageletTestLayout</title> </head> <body> <div> <div>simply user error</div> </div> <BLANKLINE> </body> </html> <BLANKLINE>
Common exception (system error)
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>PageletTestLayout</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>
CHANGES
1.6.1 (2009-12-23)
Moved zope.browserresource from test dependencies to install dependencies as it is needed in the ZCML configuration.
1.6.0 (2009-11-30)
change view for zope.publisher.interfaces.ITraversalException from system error pagelet to not found pagelet
move authentication viewlets to z3c.authviewlet.
cleanup dependencies, reflect changes in zope packages
cleanup test dependencies
1.5.0 (2009-05-28)
Removed dependency on zope.app.exception by using zope.browser>=1.2 and by implementing the exception view classes directly instead of inheriting them (Quite nothing of the base classes was in use here.)
Removed not necessary test dependency on zope.app.twisted.
Removed no longer necessary test dependency on zope.app.component.
1.4.0 (2009-03-16)
Removed direct dependency on zope.app.security by using the new packages zope.authentication and zope.principalregistry.
Removed not needed test-dependency on zope.app.zcmlfiles.
Fixed namespace package declaration in setup.py.
1.3.0 (2009-03-13)
Implemented login and logout using pagelets resp. viewlets.
Updated tests to use new zope.configuration which containts the exclude directive.
1.2.1 (2009-02-21)
Release 1.2.0 was missing the test file for the security issue.
1.2.0 (2009-02-21)
Security issue: The traverser defined for IPageletBrowserLayer was a trusted adapter, so the security proxy got removed from each traversed object. Thus all sub-objects were publically accessable, too.
1.1.0 (2009-02-14)
Bugfix: use IContentTemplate instead of IPageTemplate which avoids to get the layout template if no IPageTemplate is registered.
Using zope.location.interfaces.ISite instead of zope.app.component.interfaces.ISite.
Using zope.container instead of zope.app.container.
Cleaned up dependencies.
1.0.1 (2008-01-24)
Bug: Update meta data.
1.0.0 (2008-01-21)
Restructure: Move z3c.layer.pagelet package to it’s own top level package form z3c.layer to z3c.layer.pagelet.
Restructure: Removed zope.app.form support from pagelet layer.
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)
Bug: 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.