{ "info": { "author": "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 :: Zope :: 3", "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.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Internet :: WWW/HTTP" ], "description": "Pagelets are Zope 3 UI components. In particular they allow the developer to\nspecify content templates without worrying about the UI O-wrap.\n\n\n========\nPagelets\n========\n\n.. contents::\n\nThis package provides a very flexible base implementation that can be used\nto write view components which can be higly customized later in custom projects.\nThis is needed if you have to write reusable components like those needed\nin a framework. Pagelets are BrowserPages made differently and can be used\nto replace them.\n\nWhat does this mean?\n\nWe separate the python view code from the template implementation. And we also\nseparate the template in at least two different templates - the content\ntemplate and the layout template.\n\nThis package uses z3c.template and offers an implementaton for this\ntemplate pattern. Additionaly this package offers a ``pagelet`` directive\nwich can be used to register pagelets.\n\nPagelets are views which can be called and support the update and render\npattern.\n\n\nHow do they work\n----------------\n\nA pagelet returns the rendered content without layout in the render method and\nreturns the layout code if we call it. See also z3c.template which shows\nhow the template works. These samples will only show how the base implementation\nlocated in the z3c.pagelet.browser module get used.\n\n\nBrowserPagelet\n--------------\n\nThe base implementation called BrowserPagelet offers builtin __call__ and\nrender methods which provide the different template lookups. Take a look at the\nBrowserPagelet class located in z3c.pagelet.browser and you can see that the render\nmethod returns a IContentTemplate and the __call__ method a ILayoutTemplate\ndefined in the z3c.layout package.\n\n >>> import os, tempfile\n >>> temp_dir = tempfile.mkdtemp()\n\n >>> import zope.interface\n >>> import zope.component\n >>> from z3c.pagelet import interfaces\n >>> from z3c.pagelet import browser\n\nWe start by defining a page template rendering the pagelet content.\n\n >>> contentTemplate = os.path.join(temp_dir, 'contentTemplate.pt')\n >>> with open(contentTemplate, 'w') as file:\n ... _ = file.write('''\n ...