{ "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": "==============\n z3c.template\n==============\n\n\n.. image:: https://img.shields.io/pypi/v/z3c.template.svg\n :target: https://pypi.python.org/pypi/z3c.template/\n :alt: Latest release\n\n.. image:: https://img.shields.io/pypi/pyversions/z3c.template.svg\n :target: https://pypi.org/project/z3c.template/\n :alt: Supported Python versions\n\n.. image:: https://travis-ci.org/zopefoundation/z3c.template.svg?branch=master\n :target: https://travis-ci.org/zopefoundation/z3c.template\n\n.. image:: https://coveralls.io/repos/github/zopefoundation/z3c.template/badge.svg?branch=master\n :target: https://coveralls.io/github/zopefoundation/z3c.template?branch=master\n\n\nThis package allows you to register templates independently from view code.\n\nIn Zope 3, when registering a ``browser:page`` both presentation and computation\nare registered together. Unfortunately the registration tangles presentation\nand computation so tightly that it is not possible to re-register a different\ntemplate depending on context. (You can override the whole registration but\nthis is not the main point of this package.)\n\nWith z3c.template the registration is split up between the view and the\ntemplate and allows to differentiate the template based on the skin layer and\nthe view.\n\nIn addition this package lays the foundation to differentiate between\ntemplates that provide specific presentation templates and generic layout\ntemplates.\n\n\n.. contents::\n\n===============\n Z3C Templates\n===============\n\nThis package allows us to separate the registration of the view code and the\nlayout.\n\nA template is used for separate the HTML part from a view. This is done in\nz3 via a page templates. Such page template are implemented in the view,\nregistered included in a page directive etc. But they do not use the adapter\npattern which makes it hard to replace existing templates.\n\nAnother part of template is, that they normaly separate one part presenting\ncontent from a view and another part offer a layout used by the content\ntemplate.\n\nHow can this package make it simpler to use templates?\n\nTemplates can be registered as adapters adapting context, request where the\ncontext is a view implementation. Such a template get adapted from the view\nif the template is needed. This adaption makes it very pluggable and modular.\n\nWe offer two base template directive for register content producing templates\nand layout producing tempaltes. This is most the time enough but you also\ncan register different type of templates using a specific interface. This\ncould be usefull if your view implementation needs to separate HTMl in\nmore then one template. Now let's take a look how we an use this templates.\n\n\nContent template\n================\n\nFirst let's show how we use a template for produce content from a view:\n\n >>> import os, tempfile\n >>> temp_dir = tempfile.mkdtemp()\n >>> contentTemplate = os.path.join(temp_dir, 'contentTemplate.pt')\n >>> with open(contentTemplate, 'w') as file:\n ... _ = file.write('