{ "info": { "author": "Stephan Richter, Roger Ineichen and the Zope Community", "author_email": "zope-dev@zope.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Zope3", "Intended Audience :: Developers", "License :: OSI Approved :: Zope Public License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Internet :: WWW/HTTP" ], "description": "This package provides a layer based on z3c.form and z3c.pagelet. This layer can \nbe used in custom skins.\n\n\n.. contents::\n\n\n===========================\nReady-2-Go Layer for Zope 3\n===========================\n\nThis package contains the `ready2go` layer. This layer supports a correct set of\ncomponent registration and can be used for inheritation in custom skins.\n\nImportant\n---------\n\nThis layer supports the ``z3c.pagelet`` and the ``z3c.form`` pattern. This\nmeans every page e.g. the error page is based on the ``z3c.pagelet``\nconcept. By default we use the ``
``-based layout for z3c forms.\n\n\n``IReady2GoBrowserLayer`` Layer\n-------------------------------\n\nThe `ready2go` layer is useful for build custom presentation skins without\naccess to ZMI menus like ``zmi_views`` etc. This means there is no menu item\nregistred if you use this layer.\n\nFor more information about what this layer offers, see ``z3c.layer.pagelet``.\n\n\nTesting\n-------\n\nFor testing the ``IReady2GoBrowserLayer`` layer we use the testing skin\ndefined in the tests package which uses the ``IReady2GoBrowserLayer`` layer as\nthe only base layer. This means, that our testing skin provides only the\nviews defined in the minimal package and it's testing views defined in tests.\n\nLogin as manager first:\n\n >>> from webtest.app import TestApp\n >>> manager = TestApp(\n ... make_wsgi_app(), extra_environ={\n ... 'wsgi.handleErrors': False,\n ... 'HTTP_AUTHORIZATION': 'Basic mgr:mgrpw'})\n >>> err_manager = TestApp(\n ... make_wsgi_app(), extra_environ={\n ... 'HTTP_AUTHORIZATION': 'Basic mgr:mgrpw'})\n\nCheck if we can access the ``page.html`` view which is registred in the\n``ftesting.zcml`` file with our skin:\n\n >>> skinURL = 'http://localhost/++skin++Ready2GoTestSkin'\n >>> res = manager.get(skinURL + '/page.html')\n >>> res.request.url\n 'http://localhost/++skin++Ready2GoTestSkin/page.html'\n\n\nPagelet support\n---------------\n\nCheck if we can access the test page given from the ``z3c.layer.pagelet``\n``ftesting.zcml`` configuration.\n\n >>> print(res.html) #doctest: +PARSE_HTML\n \n \n PageletTestLayout\n \n \n test page\n \n \n\n\nNot Found\n~~~~~~~~~\n\nNow check the not found page which is a exception view on the exception\n``zope.publisher.interfaces.INotFound``:\n\n >>> manager.get(skinURL + '/foobar.html')\n Traceback (most recent call last):\n ...\n NotFound: Object: , name: 'foobar.html'\n\n >>> res = err_manager.get(skinURL + '/foobar.html', status=404)\n >>> print(res.html)\n \n \n PageletTestLayout\n \n \n
\n
\n
\n

\n The page you are trying to access is not available\n

\n
\n \n Please try the following:\n \n
\n
    \n
  1. \n Make sure that the Web site address is spelled correctly.\n
  2. \n
  3. \n \n Go back and try another URL.\n \n
  4. \n
\n
\n \n \n\n\nUser error\n~~~~~~~~~~\n\nAnd check the user error page which is a view registred for\n``zope.exceptions.interfaces.IUserError`` exceptions:\n\n >>> res = err_manager.get(skinURL + '/@@usererror.html')\n >>> print(res.html)\n \n \n PageletTestLayout\n \n \n
\n
simply user error
\n
\n \n \n\n\nCommon exception (system error)\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nAnd check error view registred for\n``zope.interface.common.interfaces.IException``:\n\n >>> res = err_manager.get(skinURL + '/@@systemerror.html', status=500)\n >>> print(res.html)\n \n \n PageletTestLayout\n \n \n
\n
\n
\n

A system error occurred

\n
\n Please contact the administrator.\n \n Go back and try another URL.\n \n
\n \n \n\n\nForbidden 403\n~~~~~~~~~~~~~\n\nAnd check the ``zope.security.interfaces.IUnauthorized`` view, use a new\nunregistred user (test browser) for this.\n\n >>> unauthorized = TestApp(make_wsgi_app())\n >>> unauthorized.get(skinURL + '/@@forbidden.html')\n Traceback (most recent call last):\n ...\n AppError: Bad response: 403 Forbidden\n\n >>> res = unauthorized.get(skinURL + '/@@forbidden.html', status=403)\n >>> print(res.html)\n \n \n PageletTestLayout\n \n \n
\n
\n
\n

Unauthorized

\n
\n You are not authorized.\n
\n \n \n\nAs you can see, this test will return a 403 Forbidden error. But this is only\nbecause we do not have an unauthenticated principal available. See the test\nbelow what happens if we register an unauthenticated princiapl.\n\n\nUnauthorized 401\n~~~~~~~~~~~~~~~~\n\nIf we use an authenticated principal and access the forbitten page, we will get\na 401 Unauthorized instead of a 403 Forbidden error page.\n\n >>> from zope.configuration import xmlconfig\n >>> import zope.principalregistry\n >>> def zcml(s):\n ... context = xmlconfig.file('meta.zcml', zope.principalregistry)\n ... xmlconfig.string(s, context)\n\n >>> zcml(\"\"\"\n ... \n ...\n ... \n ...\n ... \n ... \"\"\")\n\n >>> manager2 = TestApp(make_wsgi_app(), extra_environ={\n ... 'wsgi.handleErrors': True})\n >>> res = manager2.get(skinURL + '/@@forbidden.html')\n Traceback (most recent call last):\n ...\n AppError: Bad response: 401 Unauthorized\n\n >>> res = manager2.get(skinURL + '/@@forbidden.html', status=401)\n >>> print(res.html)\n \n \n PageletTestLayout\n \n \n
\n
\n
\n

Unauthorized

\n
\n You are not authorized.\n
\n \n \n\n\nForm and form layout support\n----------------------------\n\nThis layer offers also form macros given from ``z3c.formui``. Let's create a\nsimple form:\n\n >>> from z3c.form import testing\n >>> testing.setupFormDefaults()\n\nBefore we can start writing forms, we must have the content to work with:\n\n >>> import zope.interface\n >>> import zope.schema\n >>> class IPerson(zope.interface.Interface):\n ...\n ... name = zope.schema.TextLine(\n ... title=u'Name',\n ... required=True)\n ...\n ... age = zope.schema.Int(\n ... title=u'Age',\n ... description=u\"The person's age.\",\n ... min=0,\n ... default=20,\n ... required=False)\n\n >>> from zope.schema.fieldproperty import FieldProperty\n >>> @zope.interface.implementer(IPerson)\n ... class Person(object):\n ... name = FieldProperty(IPerson['name'])\n ... age = FieldProperty(IPerson['age'])\n ...\n ... def __init__(self, name, age):\n ... self.name = name\n ... self.age = age\n ...\n ... def __repr__(self):\n ... return '<%s %r>' % (self.__class__.__name__, self.name)\n\nOkay, that should suffice for now. Let's now create a working add form:\n\n >>> from z3c.form import field\n >>> from z3c.formui import form, layout\n >>> class PersonAddForm(form.AddForm):\n ...\n ... fields = field.Fields(IPerson)\n ...\n ... def create(self, data):\n ... return Person(**data)\n ...\n ... def add(self, object):\n ... self.context[object.id] = object\n ...\n ... def nextURL(self):\n ... return 'index.html'\n\nLet's create a request:\n\n >>> from z3c.form.testing import TestRequest\n >>> from zope.interface import alsoProvides\n >>> divRequest = TestRequest()\n\nAnd support the div form layer for our request:\n\n >>> from z3c.formui.interfaces import IDivFormLayer\n >>> alsoProvides(divRequest, IDivFormLayer)\n\nNow create the form:\n\n >>> root = getRootFolder()\n >>> addForm = PersonAddForm(root, divRequest)\n\nSince we have not specified a template yet, we have to do this now. We use our\ndiv based form template:\n\n >>> import os\n >>> import z3c.formui\n >>> divFormTemplate = os.path.join(os.path.dirname(z3c.formui.__file__),\n ... 'div-form.pt')\n\n >>> from z3c.template.template import TemplateFactory\n >>> divFormFactory = TemplateFactory(divFormTemplate, 'text/html')\n\nNow register the form (content) template:\n\n >>> import zope.interface\n >>> import zope.component\n >>> from z3c.template.interfaces import IContentTemplate\n >>> zope.component.provideAdapter(divFormFactory,\n ... (zope.interface.Interface, IDivFormLayer),\n ... IContentTemplate)\n\nAnd let's define a layout template which simply calls the render method. For a\nmore adavanced content/layout render concept see ``z3c.pagelet``.\n\n >>> import tempfile\n >>> temp_dir = tempfile.mkdtemp()\n\n >>> myLayout = os.path.join(temp_dir, 'myLayout.pt')\n >>> with open(myLayout, 'w') as file:\n ... _ = file.write('''\n ... \n ... \n ... content\n ... \n ... \n ... ''')\n >>> myLayoutFactory = TemplateFactory(myLayout, 'text/html')\n\n >>> from z3c.template.interfaces import ILayoutTemplate\n >>> zope.component.provideAdapter(myLayoutFactory,\n ... (zope.interface.Interface, zope.interface.Interface), ILayoutTemplate)\n\nNow we can get our layout template:\n\n >>> layout = zope.component.getMultiAdapter((addForm, divRequest),\n ... ILayoutTemplate)\n\n >>> layout\n \n\n\nDIV-based Layout\n----------------\n\nLet's now render the page. Note the output doesn't contain the layout template:\n\n >>> addForm.update()\n >>> print(addForm.render())\n
\n
\n
\n *– required\n
\n
\n
\n
\n \n
\n
\n \n
\n
\n
\n
\n \n
\n
\n \n
\n
\n
\n
\n
\n
\n \n
\n
\n
\n\n\nForm Macros\n-----------\n\nTry at least to load the confguration, which will make sure that all macros\nget registered correctly.\n\n >>> from zope.configuration import xmlconfig\n >>> import zope.component\n >>> import zope.security\n >>> import zope.viewlet\n >>> import zope.browserpage\n >>> import zope.browserresource\n >>> import z3c.macro\n >>> import z3c.template\n >>> import z3c.formui\n >>> xmlconfig.XMLConfig('meta.zcml', zope.browserpage)()\n >>> xmlconfig.XMLConfig('meta.zcml', zope.browserresource)()\n >>> xmlconfig.XMLConfig('meta.zcml', zope.component)()\n >>> xmlconfig.XMLConfig('meta.zcml', zope.security)()\n >>> xmlconfig.XMLConfig('meta.zcml', zope.viewlet)()\n >>> xmlconfig.XMLConfig('meta.zcml', z3c.macro)()\n >>> xmlconfig.XMLConfig('meta.zcml', z3c.template)()\n >>> xmlconfig.XMLConfig('configure.zcml', z3c.formui)()\n\n\nDiv layout macros\n-----------------\n\nNow we can see that we have different form macros available:\n\n >>> from z3c.macro.interfaces import IMacroTemplate\n >>> objects = (None, addForm, divRequest)\n >>> zope.component.getMultiAdapter(objects, IMacroTemplate, 'form')\n [...div-form.pt'), ...metal:define-macro': u'form'...\n\n\n >>> zope.component.getMultiAdapter(objects, IMacroTemplate, 'subform')\n [...div-form.pt'), ...define-macro': u'subform'...\n\n\n >>> zope.component.getMultiAdapter(objects, IMacroTemplate, 'form-label')\n [...div-form.pt'), ...define-macro': u'label'...\n\n\n >>> zope.component.getMultiAdapter(objects, IMacroTemplate, 'form-required-info')\n [...div-form.pt'), ...define-macro', u'required-info'...\n\n\n >>> zope.component.getMultiAdapter(objects, IMacroTemplate, 'form-header')\n [...div-form.pt'), ...define-macro': u'header'...\n\n\n >>> zope.component.getMultiAdapter(objects, IMacroTemplate, 'form-errors')\n [...div-form.pt'), ...define-macro': u'errors'...\n\n\n >>> zope.component.getMultiAdapter(objects, IMacroTemplate, 'widget-rows')\n [...div-form.pt'), ...define-macro': u'widget-rows'...\n\n\n >>> zope.component.getMultiAdapter(objects, IMacroTemplate, 'widget-row')\n [...div-form.pt'), ...define-macro': u'widget-row'...\n\n\n >>> zope.component.getMultiAdapter(objects, IMacroTemplate, 'form-groups')\n [...div-form.pt'), ...define-macro': u'groups'...\n\n\n >>> zope.component.getMultiAdapter(objects, IMacroTemplate, 'form-buttons')\n [...div-form.pt'), ...define-macro', u'buttons'...\n\n\nCleanup\n-------\n\n >>> import shutil\n >>> shutil.rmtree(temp_dir)\n\n\n=======\nCHANGES\n=======\n\n1.0.0 (2017-04-17)\n------------------\n\n- Pin Python support to 2.7, 3.5, 3.6 and PyPy.\n\n\n1.0.0a1 (2013-03-03)\n--------------------\n\n- Added support for Python 3.3.\n\n- Changed ``zope.testbrowser`` tests to ``WebTest``, since ``zope.testbrowser``\n is not yet ported.\n\n- Replaced deprecated ``zope.interface.implements`` usage with equivalent\n ``zope.interface.implementer`` decorator.\n\n- Dropped support for Python 2.4 and 2.5.\n\n\n- Fixed test setup and tests to run with current versions of the\n required packages.\n\n\n0.6.0 (2009-12-01)\n------------------\n\n- Adjusted dependencies, skiped dependency on `zope.app.publisher` and\n `zope.app.http` and reflected changes in Zope packages.\n\n\n0.5.3 (2009-07-24)\n------------------\n\n- Fix tests to work with latest packages.\n\n\n0.5.2 (2009-02-19)\n------------------\n\n- No longer depends on deprecated ``z3c.viewlet``.\n\n- Fixed tests to run with current ``z3c.form``.\n\n- Fixed long_description to render properly on pypi.\n\n\n0.5.1 (2008-01-24)\n------------------\n\n- Bug: Fix meta-data.\n\n\n0.5.0 (2008-01-21)\n------------------\n\n- Initial Release", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://pypi.python.org/pypi/z3c.layer.ready2go", "keywords": "zope3 z3c ready 2 go layer", "license": "ZPL 2.1", "maintainer": "", "maintainer_email": "", "name": "z3c.layer.ready2go", "package_url": "https://pypi.org/project/z3c.layer.ready2go/", "platform": "", "project_url": "https://pypi.org/project/z3c.layer.ready2go/", "project_urls": { "Homepage": "http://pypi.python.org/pypi/z3c.layer.ready2go" }, "release_url": "https://pypi.org/project/z3c.layer.ready2go/1.0.0/", "requires_dist": null, "requires_python": "", "summary": "A ready to go layer for Zope3", "version": "1.0.0" }, "last_serial": 2809474, "releases": { "0.5.0": [ { "comment_text": "", "digests": { "md5": "c49fb3f9e01bdc559c20d20524012d69", "sha256": "675d30a5fdcc0daa56a46ecc37cdcb738d450b3870345d565231ca68d2a7e8ab" }, "downloads": -1, "filename": "z3c.layer.ready2go-0.5.0.tar.gz", "has_sig": false, "md5_digest": "c49fb3f9e01bdc559c20d20524012d69", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9382, "upload_time": "2008-01-21T06:08:05", "url": "https://files.pythonhosted.org/packages/de/de/a28228bd222961d219ff3dc0518d8016da15ff39eb66c157208b4a2e2ed4/z3c.layer.ready2go-0.5.0.tar.gz" } ], "0.5.1": [ { "comment_text": "", "digests": { "md5": "1950b18c27deb3e2ca9a4943e7687163", "sha256": "03d76a962543afb6684eff6864898ac783946f8ad3987547388f6eed37a84b16" }, "downloads": -1, "filename": "z3c.layer.ready2go-0.5.1.tar.gz", "has_sig": false, "md5_digest": "1950b18c27deb3e2ca9a4943e7687163", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14357, "upload_time": "2008-01-25T02:58:55", "url": "https://files.pythonhosted.org/packages/b7/5a/63c86ac83103c401fca172a362814247a9d26dbc341370de248d3e7bd626/z3c.layer.ready2go-0.5.1.tar.gz" } ], "0.5.2": [ { "comment_text": "", "digests": { "md5": "0771f3636c27e0a70476bd7275f745d6", "sha256": "fad272c36047c54f31e9f088bfc21a431200448abdc676beb876d2d5e2bbabfd" }, "downloads": -1, "filename": "z3c.layer.ready2go-0.5.2.tar.gz", "has_sig": false, "md5_digest": "0771f3636c27e0a70476bd7275f745d6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11727, "upload_time": "2009-02-19T21:46:41", "url": "https://files.pythonhosted.org/packages/64/e7/79903f8bab73b4605761a0fe6990c798a31b5f3c56b259fff63789d108c9/z3c.layer.ready2go-0.5.2.tar.gz" } ], "0.5.3": [ { "comment_text": "", "digests": { "md5": "98516685f1a3359926c90098c7a07070", "sha256": "f33cb5b903ef6c3079b4e7fa8e2b36905b3784789dc51099ccc64fe897b110a9" }, "downloads": -1, "filename": "z3c.layer.ready2go-0.5.3.tar.gz", "has_sig": false, "md5_digest": "98516685f1a3359926c90098c7a07070", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12740, "upload_time": "2009-07-24T11:35:52", "url": "https://files.pythonhosted.org/packages/ce/b9/b29a75c02edbe004c9c4d813aa24c005b351cd82b896399dd3ecae812799/z3c.layer.ready2go-0.5.3.tar.gz" } ], "0.6.0": [ { "comment_text": "", "digests": { "md5": "41f483c8169b53f0696800789938e7ea", "sha256": "b403fb3dacc6e1d5dbb77e942535109ae9d56d3071576842e83a6fa1ad2938af" }, "downloads": -1, "filename": "z3c.layer.ready2go-0.6.0.zip", "has_sig": false, "md5_digest": "41f483c8169b53f0696800789938e7ea", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24021, "upload_time": "2009-12-01T10:14:28", "url": "https://files.pythonhosted.org/packages/f9/5e/3d71f39ecf03b830266f3d1b8a9bc429655f030ebfe8a54e9bf9a2e226a1/z3c.layer.ready2go-0.6.0.zip" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "8e58d55a53bb13b40ebd68d52932f410", "sha256": "ca5b011afbeb31fc48b1c0f8baa81232bc21a39df1713cee4cde4f87145b08a7" }, "downloads": -1, "filename": "z3c.layer.ready2go-1.0.0.tar.gz", "has_sig": false, "md5_digest": "8e58d55a53bb13b40ebd68d52932f410", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17506, "upload_time": "2017-04-17T19:49:44", "url": "https://files.pythonhosted.org/packages/d7/c4/6f21bfdb7f7dea50610032264605ae812ab3b03d6be9ea5638315a1c497a/z3c.layer.ready2go-1.0.0.tar.gz" } ], "1.0.0a1": [ { "comment_text": "", "digests": { "md5": "ab1a39180481b082547c7c1343fae2d7", "sha256": "fd5db40522fdc170191f96cf2c871e11083582c0f2c57c050acfcc24a9ed96a7" }, "downloads": -1, "filename": "z3c.layer.ready2go-1.0.0a1.zip", "has_sig": false, "md5_digest": "ab1a39180481b082547c7c1343fae2d7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 29760, "upload_time": "2013-03-04T01:31:28", "url": "https://files.pythonhosted.org/packages/16/53/3172ff02d1778bc1cc5a1246dbd0c6d6b80ef8b3632ac8c12463a7a6aaba/z3c.layer.ready2go-1.0.0a1.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8e58d55a53bb13b40ebd68d52932f410", "sha256": "ca5b011afbeb31fc48b1c0f8baa81232bc21a39df1713cee4cde4f87145b08a7" }, "downloads": -1, "filename": "z3c.layer.ready2go-1.0.0.tar.gz", "has_sig": false, "md5_digest": "8e58d55a53bb13b40ebd68d52932f410", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17506, "upload_time": "2017-04-17T19:49:44", "url": "https://files.pythonhosted.org/packages/d7/c4/6f21bfdb7f7dea50610032264605ae812ab3b03d6be9ea5638315a1c497a/z3c.layer.ready2go-1.0.0.tar.gz" } ] }