z3c.macro


Namez3c.macro JSON
Version 3.0 PyPI version JSON
download
home_pagehttps://github.com/zopefoundation/z3c.macro
SummarySimpler definition of ZPT macros.
upload_time2024-01-11 07:45:20
maintainer
docs_urlNone
authorRoger Ineichen and the Zope Community
requires_python>=3.7
licenseZPL 2.1
keywords zope3 macro pagetemplate zpt
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. image:: https://img.shields.io/pypi/v/z3c.macro.svg
        :target: https://pypi.python.org/pypi/z3c.macro/
        :alt: Latest release

.. image:: https://img.shields.io/pypi/pyversions/z3c.macro.svg
        :target: https://pypi.org/project/z3c.macro/
        :alt: Supported Python versions

.. image:: https://github.com/zopefoundation/z3c.macro/actions/workflows/tests.yml/badge.svg
        :target: https://github.com/zopefoundation/z3c.macro/actions/workflows/tests.yml

.. image:: https://coveralls.io/repos/github/zopefoundation/z3c.macro/badge.svg?branch=master
        :target: https://coveralls.io/github/zopefoundation/z3c.macro?branch=master

This package provides an adapter and a TALES expression for a more explicit and
more flexible macro handling using the adapter registry for macros.


Detailed Documentation
======================


=====
Macro
=====

This package provides a adapter and a TALES expression for a expliciter and
flexibler macro handling using the adapter registry for macros.

We start with creating a content object that is used as a view context later:

  >>> import zope.interface
  >>> import zope.component
  >>> from zope.publisher.interfaces.browser import IBrowserView
  >>> from zope.publisher.interfaces.browser import IDefaultBrowserLayer
  >>> @zope.interface.implementer(zope.interface.Interface)
  ... class Content(object):
  ...     pass

  >>> content = Content()

We also create a temp dir for sample templates which we define later for
testing:

  >>> import os, tempfile
  >>> temp_dir = tempfile.mkdtemp()


Macro Template
--------------

We define a macro template as a adapter providing IMacroTemplate:

  >>> path = os.path.join(temp_dir, 'navigation.pt')
  >>> with open(path, 'w') as file:
  ...     _ = file.write('''
  ... <metal:block define-macro="navigation">
  ...   <div tal:content="title">---</div>
  ... </metal:block>
  ... ''')

Let's define the macro factory

  >>> from z3c.macro import interfaces
  >>> from z3c.macro import zcml
  >>> navigationMacro = zcml.MacroFactory(path, 'navigation', 'text/html')

and register them as adapter:

  >>> zope.component.provideAdapter(
  ...     navigationMacro,
  ...     (zope.interface.Interface, IBrowserView, IDefaultBrowserLayer),
  ...     interfaces.IMacroTemplate,
  ...     name='navigation')


The TALES ``macro`` Expression
------------------------------

The ``macro`` expression will look up the name of the macro, call a adapter
providing IMacroTemplate and uses them or fills a slot if defined in the
``macro`` expression.

Let's create a page template using the ``navigation`` macros:

  >>> path = os.path.join(temp_dir, 'first.pt')
  >>> with open(path, 'w') as file:
  ...     _ = file.write('''
  ... <html>
  ...   <body>
  ...     <h1>First Page</h1>
  ...     <div class="navi">
  ...       <tal:block define="title string:My Navigation">
  ...         <metal:block use-macro="macro:navigation" />
  ...       </tal:block>
  ...     </div>
  ...     <div class="content">
  ...       Content here
  ...     </div>
  ...   </body>
  ... </html>
  ... ''')

As you can see, we used the ``macro`` expression to simply look up a macro
called navigation whihc get inserted and replaces the HTML content at this
place.

Let's now create a view using this page template:

  >>> from zope.publisher.browser import BrowserView
  >>> class simple(BrowserView):
  ...     def __getitem__(self, name):
  ...         return self.index.macros[name]
  ...
  ...     def __call__(self, **kwargs):
  ...         return self.index(**kwargs)

  >>> from zope.browserpage.viewpagetemplatefile import ViewPageTemplateFile
  >>> def SimpleViewClass(path, name=u''):
  ...     return type(
  ...         "SimpleViewClass", (simple,),
  ...         {'index': ViewPageTemplateFile(path), '__name__': name})

  >>> FirstPage = SimpleViewClass(path, name='first.html')

  >>> zope.component.provideAdapter(
  ...     FirstPage,
  ...     (zope.interface.Interface, IDefaultBrowserLayer),
  ...     zope.interface.Interface,
  ...     name='first.html')

Finally we look up the view and render it:

  >>> from zope.publisher.browser import TestRequest
  >>> request = TestRequest()

  >>> view = zope.component.getMultiAdapter((content, request),
  ...                                       name='first.html')
  >>> print(view().strip())
  <html>
    <body>
      <h1>First Page</h1>
      <div class="navi">
        <div>My Navigation</div>
      </div>
      <div class="content">
        Content here
      </div>
    </body>
  </html>


Slot
----

We can also define a macro slot and fill it with given content:

  >>> path = os.path.join(temp_dir, 'addons.pt')
  >>> with open(path, 'w') as file:
  ...     _ = file.write('''
  ... <metal:block define-macro="addons">
  ...   Content before header
  ...   <metal:block define-slot="header">
  ...     <div>My Header</div>
  ...   </metal:block>
  ...   Content after header
  ... </metal:block>
  ... ''')

Let's define the macro factory

  >>> addonsMacro = zcml.MacroFactory(path, 'addons', 'text/html')

and register them as adapter:

  >>> zope.component.provideAdapter(
  ...     addonsMacro,
  ...     (zope.interface.Interface, IBrowserView, IDefaultBrowserLayer),
  ...     interfaces.IMacroTemplate,
  ...     name='addons')

Let's create a page template using the ``addons`` macros:

  >>> path = os.path.join(temp_dir, 'second.pt')
  >>> with open(path, 'w') as file:
  ...     _ = file.write('''
  ... <html>
  ...   <body>
  ...     <h1>Second Page</h1>
  ...     <div class="header">
  ...       <metal:block use-macro="macro:addons">
  ...         This line get ignored
  ...         <metal:block fill-slot="header">
  ...           Header comes from here
  ...         </metal:block>
  ...         This line get ignored
  ...       </metal:block>
  ...     </div>
  ...   </body>
  ... </html>
  ... ''')

Let's now create a view using this page template:

  >>> SecondPage = SimpleViewClass(path, name='second.html')

  >>> zope.component.provideAdapter(
  ...     SecondPage,
  ...     (zope.interface.Interface, IDefaultBrowserLayer),
  ...     zope.interface.Interface,
  ...     name='second.html')

Finally we look up the view and render it:

  >>> view = zope.component.getMultiAdapter((content, request),
  ...                                       name='second.html')
  >>> print(view().strip())
  <html>
    <body>
      <h1>Second Page</h1>
      <div class="header">
  <BLANKLINE>
    Content before header
  <BLANKLINE>
            Header comes from here
  <BLANKLINE>
    Content after header
      </div>
    </body>
  </html>


Cleanup
-------

  >>> import shutil
  >>> shutil.rmtree(temp_dir)



=================
 macro directive
=================

A macro directive can be used for register macros. Take a look at the
README.txt which explains the macro TALES expression.

  >>> import sys
  >>> from zope.configuration import xmlconfig
  >>> import z3c.template
  >>> context = xmlconfig.file('meta.zcml', z3c.macro)

First define a template which defines a macro:

  >>> import os, tempfile
  >>> temp_dir = tempfile.mkdtemp()
  >>> file_path = os.path.join(temp_dir, 'file.pt')
  >>> with open(file_path, 'w') as file:
  ...     _ = file.write('''
  ... <html>
  ...   <head>
  ...     <metal:block define-macro="title">
  ...        <title>Pagelet skin</title>
  ...     </metal:block>
  ...   </head>
  ...   <body>
  ...     <div>content</div>
  ...   </body>
  ... </html>
  ... ''')

and register the macro provider within the ``z3c:macroProvider`` directive:

  >>> context = xmlconfig.string("""
  ... <configure
  ...     xmlns:z3c="http://namespaces.zope.org/z3c">
  ...   <z3c:macro
  ...       template="%s"
  ...       name="title"
  ...       />
  ... </configure>
  ... """ % file_path, context=context)

We need a content object...

  >>> import zope.interface
  >>> @zope.interface.implementer(zope.interface.Interface)
  ... class Content(object):
  ...     pass
  >>> content = Content()

and we need a view...

  >>> import zope.interface
  >>> import zope.component
  >>> from zope.publisher.browser import BrowserPage
  >>> class View(BrowserPage):
  ...     def __init__(self, context, request):
  ...         self.context = context
  ...         self.request = request

and we need a request:
  >>> from zope.publisher.browser import TestRequest
  >>> request = TestRequest()

Check if we get the macro template:

  >>> from z3c.macro import interfaces
  >>> view = View(content, request)

  >>> macro = zope.component.queryMultiAdapter((content, view, request),
  ...     interface=interfaces.IMacroTemplate, name='title')

  >>> macro is not None
  True

  >>> import os, tempfile
  >>> temp_dir = tempfile.mkdtemp()
  >>> test_path = os.path.join(temp_dir, 'test.pt')
  >>> with open(test_path, 'w') as file:
  ...     _ = file.write('''
  ... <html>
  ...   <body>
  ...     <metal:macro use-macro="options/macro" />
  ...   </body>
  ... </html>
  ... ''')

  >>> from zope.browserpage.viewpagetemplatefile import BoundPageTemplate
  >>> from zope.browserpage.viewpagetemplatefile import ViewPageTemplateFile
  >>> template = ViewPageTemplateFile(test_path)
  >>> print(BoundPageTemplate(template, view)(macro=macro))
  <html>
    <body>
      <title>Pagelet skin</title>
    </body>
  </html>

Error Conditions
================

If the file is not available, the directive fails:

  >>> context = xmlconfig.string("""
  ... <configure
  ...     xmlns:z3c="http://namespaces.zope.org/z3c">
  ...   <z3c:macro
  ...       template="this_file_does_not_exist"
  ...       name="title"
  ...       />
  ... </configure>
  ... """, context=context)
  Traceback (most recent call last):
  ...
  zope.configuration.exceptions.ConfigurationError: ...


=======
CHANGES
=======

3.0 (2024-01-11)
----------------

- Add support for Python 3.11, 3.12.

- Drop support for Python 2.7, 3.5, 3.6.


2.3 (2021-12-16)
----------------

- Add support for Python 3.5, 3.8, 3.9, and 3.10.


2.2.1 (2018-12-05)
------------------

- Fix list of supported Python versions in Trove classifiers: The currently
  supported Python versions are 2.7, 3.6, 3.7, PyPy2 and PyPy3.

- Flake8 the code.


2.2.0 (2018-11-13)
------------------

- Removed Python 3.5 support, added Python 3.7.

- Fixed up tests.

- Fix docstring that caused DeprecationWarning.


2.1.0 (2017-10-17)
------------------

- Drop support for Python 2.6 and 3.3.

- Add support for Python 3.4, 3.5 and 3.6.

- Add support for PyPy.


2.0.0 (2015-11-09)
------------------

- Standardize namespace ``__init__``.


2.0.0a1 (2013-02-25)
--------------------

- Added support for Python 3.3.

- Replaced deprecated ``zope.interface.implements`` usage with equivalent
  ``zope.interface.implementer`` decorator.

- Dropped support for Python 2.4 and 2.5.


1.4.2 (2012-02-15)
------------------

- Remove hooks to use ViewPageTemplateFile from z3c.pt because this breaks when
  z3c.pt is available, but z3c.ptcompat is not included. As recommended by notes
  in 1.4.0 release.


1.4.1 (2011-11-15)
------------------

- bugfix, missing comma in setup install_requires list


1.4.0 (2011-10-29)
------------------

- Moved z3c.pt include to extras_require chameleon. This makes the package
  independent from chameleon and friends and allows to include this
  dependencies in your own project.

- Upgrade to chameleon 2.0 template engine and use the newest z3c.pt and
  z3c.ptcompat packages adjusted to work with chameleon 2.0.

  See the notes from the z3c.ptcompat package:

  Update z3c.ptcompat implementation to use component-based template engine
  configuration, plugging directly into the Zope Toolkit framework.

  The z3c.ptcompat package no longer provides template classes, or ZCML
  directives; you should import directly from the ZTK codebase.

  Note that the ``PREFER_Z3C_PT`` environment option has been
  rendered obsolete; instead, this is now managed via component
  configuration.

  Also note that the chameleon CHAMELEON_CACHE environment value changed from
  True/False to a path. Skip this property if you don't like to use a cache.
  None or False defined in buildout environment section doesn't work. At least
  with chameleon <= 2.5.4

  Attention: You need to include the configure.zcml file from z3c.ptcompat
  for enable the z3c.pt template engine. The configure.zcml will plugin the
  template engine. Also remove any custom built hooks which will import
  z3c.ptcompat in your tests or other places.


1.3.0 (2010-07-05)
------------------

- Tests now require ``zope.browserpage >= 3.12`` instead of
  ``zope.app.pagetemplate`` as the expression type registration has
  been moved there recently.

- No longer using deprecated ``zope.testing.doctestunit`` but built-in
  ``doctest`` instead.


1.2.1 (2009-03-07)
------------------

- Presence of ``z3c.pt`` is not sufficient to register macro-utility,
  ``chameleon.zpt`` is required otherwise the factory for the utility
  is not defined.


1.2.0 (2009-03-07)
------------------

- Allow use of ``z3c.pt`` using ``z3c.ptcompat`` compatibility layer.

- Change package's mailing list address to zope-dev at zope.org.


1.1.0 (2007-11-01)
------------------

- Update package info data.

- Add z3c namespace package declaration.


1.0.0 (2007-09-30)
------------------

- Initial release.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/zopefoundation/z3c.macro",
    "name": "z3c.macro",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "zope3 macro pagetemplate zpt",
    "author": "Roger Ineichen and the Zope Community",
    "author_email": "zope-dev@zope.org",
    "download_url": "https://files.pythonhosted.org/packages/a4/65/8a6744f7a57e6187c869fe61380980b8fc26a995734ee7b5c7e0abc3da36/z3c.macro-3.0.tar.gz",
    "platform": null,
    "description": ".. image:: https://img.shields.io/pypi/v/z3c.macro.svg\n        :target: https://pypi.python.org/pypi/z3c.macro/\n        :alt: Latest release\n\n.. image:: https://img.shields.io/pypi/pyversions/z3c.macro.svg\n        :target: https://pypi.org/project/z3c.macro/\n        :alt: Supported Python versions\n\n.. image:: https://github.com/zopefoundation/z3c.macro/actions/workflows/tests.yml/badge.svg\n        :target: https://github.com/zopefoundation/z3c.macro/actions/workflows/tests.yml\n\n.. image:: https://coveralls.io/repos/github/zopefoundation/z3c.macro/badge.svg?branch=master\n        :target: https://coveralls.io/github/zopefoundation/z3c.macro?branch=master\n\nThis package provides an adapter and a TALES expression for a more explicit and\nmore flexible macro handling using the adapter registry for macros.\n\n\nDetailed Documentation\n======================\n\n\n=====\nMacro\n=====\n\nThis package provides a adapter and a TALES expression for a expliciter and\nflexibler macro handling using the adapter registry for macros.\n\nWe start with creating a content object that is used as a view context later:\n\n  >>> import zope.interface\n  >>> import zope.component\n  >>> from zope.publisher.interfaces.browser import IBrowserView\n  >>> from zope.publisher.interfaces.browser import IDefaultBrowserLayer\n  >>> @zope.interface.implementer(zope.interface.Interface)\n  ... class Content(object):\n  ...     pass\n\n  >>> content = Content()\n\nWe also create a temp dir for sample templates which we define later for\ntesting:\n\n  >>> import os, tempfile\n  >>> temp_dir = tempfile.mkdtemp()\n\n\nMacro Template\n--------------\n\nWe define a macro template as a adapter providing IMacroTemplate:\n\n  >>> path = os.path.join(temp_dir, 'navigation.pt')\n  >>> with open(path, 'w') as file:\n  ...     _ = file.write('''\n  ... <metal:block define-macro=\"navigation\">\n  ...   <div tal:content=\"title\">---</div>\n  ... </metal:block>\n  ... ''')\n\nLet's define the macro factory\n\n  >>> from z3c.macro import interfaces\n  >>> from z3c.macro import zcml\n  >>> navigationMacro = zcml.MacroFactory(path, 'navigation', 'text/html')\n\nand register them as adapter:\n\n  >>> zope.component.provideAdapter(\n  ...     navigationMacro,\n  ...     (zope.interface.Interface, IBrowserView, IDefaultBrowserLayer),\n  ...     interfaces.IMacroTemplate,\n  ...     name='navigation')\n\n\nThe TALES ``macro`` Expression\n------------------------------\n\nThe ``macro`` expression will look up the name of the macro, call a adapter\nproviding IMacroTemplate and uses them or fills a slot if defined in the\n``macro`` expression.\n\nLet's create a page template using the ``navigation`` macros:\n\n  >>> path = os.path.join(temp_dir, 'first.pt')\n  >>> with open(path, 'w') as file:\n  ...     _ = file.write('''\n  ... <html>\n  ...   <body>\n  ...     <h1>First Page</h1>\n  ...     <div class=\"navi\">\n  ...       <tal:block define=\"title string:My Navigation\">\n  ...         <metal:block use-macro=\"macro:navigation\" />\n  ...       </tal:block>\n  ...     </div>\n  ...     <div class=\"content\">\n  ...       Content here\n  ...     </div>\n  ...   </body>\n  ... </html>\n  ... ''')\n\nAs you can see, we used the ``macro`` expression to simply look up a macro\ncalled navigation whihc get inserted and replaces the HTML content at this\nplace.\n\nLet's now create a view using this page template:\n\n  >>> from zope.publisher.browser import BrowserView\n  >>> class simple(BrowserView):\n  ...     def __getitem__(self, name):\n  ...         return self.index.macros[name]\n  ...\n  ...     def __call__(self, **kwargs):\n  ...         return self.index(**kwargs)\n\n  >>> from zope.browserpage.viewpagetemplatefile import ViewPageTemplateFile\n  >>> def SimpleViewClass(path, name=u''):\n  ...     return type(\n  ...         \"SimpleViewClass\", (simple,),\n  ...         {'index': ViewPageTemplateFile(path), '__name__': name})\n\n  >>> FirstPage = SimpleViewClass(path, name='first.html')\n\n  >>> zope.component.provideAdapter(\n  ...     FirstPage,\n  ...     (zope.interface.Interface, IDefaultBrowserLayer),\n  ...     zope.interface.Interface,\n  ...     name='first.html')\n\nFinally we look up the view and render it:\n\n  >>> from zope.publisher.browser import TestRequest\n  >>> request = TestRequest()\n\n  >>> view = zope.component.getMultiAdapter((content, request),\n  ...                                       name='first.html')\n  >>> print(view().strip())\n  <html>\n    <body>\n      <h1>First Page</h1>\n      <div class=\"navi\">\n        <div>My Navigation</div>\n      </div>\n      <div class=\"content\">\n        Content here\n      </div>\n    </body>\n  </html>\n\n\nSlot\n----\n\nWe can also define a macro slot and fill it with given content:\n\n  >>> path = os.path.join(temp_dir, 'addons.pt')\n  >>> with open(path, 'w') as file:\n  ...     _ = file.write('''\n  ... <metal:block define-macro=\"addons\">\n  ...   Content before header\n  ...   <metal:block define-slot=\"header\">\n  ...     <div>My Header</div>\n  ...   </metal:block>\n  ...   Content after header\n  ... </metal:block>\n  ... ''')\n\nLet's define the macro factory\n\n  >>> addonsMacro = zcml.MacroFactory(path, 'addons', 'text/html')\n\nand register them as adapter:\n\n  >>> zope.component.provideAdapter(\n  ...     addonsMacro,\n  ...     (zope.interface.Interface, IBrowserView, IDefaultBrowserLayer),\n  ...     interfaces.IMacroTemplate,\n  ...     name='addons')\n\nLet's create a page template using the ``addons`` macros:\n\n  >>> path = os.path.join(temp_dir, 'second.pt')\n  >>> with open(path, 'w') as file:\n  ...     _ = file.write('''\n  ... <html>\n  ...   <body>\n  ...     <h1>Second Page</h1>\n  ...     <div class=\"header\">\n  ...       <metal:block use-macro=\"macro:addons\">\n  ...         This line get ignored\n  ...         <metal:block fill-slot=\"header\">\n  ...           Header comes from here\n  ...         </metal:block>\n  ...         This line get ignored\n  ...       </metal:block>\n  ...     </div>\n  ...   </body>\n  ... </html>\n  ... ''')\n\nLet's now create a view using this page template:\n\n  >>> SecondPage = SimpleViewClass(path, name='second.html')\n\n  >>> zope.component.provideAdapter(\n  ...     SecondPage,\n  ...     (zope.interface.Interface, IDefaultBrowserLayer),\n  ...     zope.interface.Interface,\n  ...     name='second.html')\n\nFinally we look up the view and render it:\n\n  >>> view = zope.component.getMultiAdapter((content, request),\n  ...                                       name='second.html')\n  >>> print(view().strip())\n  <html>\n    <body>\n      <h1>Second Page</h1>\n      <div class=\"header\">\n  <BLANKLINE>\n    Content before header\n  <BLANKLINE>\n            Header comes from here\n  <BLANKLINE>\n    Content after header\n      </div>\n    </body>\n  </html>\n\n\nCleanup\n-------\n\n  >>> import shutil\n  >>> shutil.rmtree(temp_dir)\n\n\n\n=================\n macro directive\n=================\n\nA macro directive can be used for register macros. Take a look at the\nREADME.txt which explains the macro TALES expression.\n\n  >>> import sys\n  >>> from zope.configuration import xmlconfig\n  >>> import z3c.template\n  >>> context = xmlconfig.file('meta.zcml', z3c.macro)\n\nFirst define a template which defines a macro:\n\n  >>> import os, tempfile\n  >>> temp_dir = tempfile.mkdtemp()\n  >>> file_path = os.path.join(temp_dir, 'file.pt')\n  >>> with open(file_path, 'w') as file:\n  ...     _ = file.write('''\n  ... <html>\n  ...   <head>\n  ...     <metal:block define-macro=\"title\">\n  ...        <title>Pagelet skin</title>\n  ...     </metal:block>\n  ...   </head>\n  ...   <body>\n  ...     <div>content</div>\n  ...   </body>\n  ... </html>\n  ... ''')\n\nand register the macro provider within the ``z3c:macroProvider`` directive:\n\n  >>> context = xmlconfig.string(\"\"\"\n  ... <configure\n  ...     xmlns:z3c=\"http://namespaces.zope.org/z3c\">\n  ...   <z3c:macro\n  ...       template=\"%s\"\n  ...       name=\"title\"\n  ...       />\n  ... </configure>\n  ... \"\"\" % file_path, context=context)\n\nWe need a content object...\n\n  >>> import zope.interface\n  >>> @zope.interface.implementer(zope.interface.Interface)\n  ... class Content(object):\n  ...     pass\n  >>> content = Content()\n\nand we need a view...\n\n  >>> import zope.interface\n  >>> import zope.component\n  >>> from zope.publisher.browser import BrowserPage\n  >>> class View(BrowserPage):\n  ...     def __init__(self, context, request):\n  ...         self.context = context\n  ...         self.request = request\n\nand we need a request:\n  >>> from zope.publisher.browser import TestRequest\n  >>> request = TestRequest()\n\nCheck if we get the macro template:\n\n  >>> from z3c.macro import interfaces\n  >>> view = View(content, request)\n\n  >>> macro = zope.component.queryMultiAdapter((content, view, request),\n  ...     interface=interfaces.IMacroTemplate, name='title')\n\n  >>> macro is not None\n  True\n\n  >>> import os, tempfile\n  >>> temp_dir = tempfile.mkdtemp()\n  >>> test_path = os.path.join(temp_dir, 'test.pt')\n  >>> with open(test_path, 'w') as file:\n  ...     _ = file.write('''\n  ... <html>\n  ...   <body>\n  ...     <metal:macro use-macro=\"options/macro\" />\n  ...   </body>\n  ... </html>\n  ... ''')\n\n  >>> from zope.browserpage.viewpagetemplatefile import BoundPageTemplate\n  >>> from zope.browserpage.viewpagetemplatefile import ViewPageTemplateFile\n  >>> template = ViewPageTemplateFile(test_path)\n  >>> print(BoundPageTemplate(template, view)(macro=macro))\n  <html>\n    <body>\n      <title>Pagelet skin</title>\n    </body>\n  </html>\n\nError Conditions\n================\n\nIf the file is not available, the directive fails:\n\n  >>> context = xmlconfig.string(\"\"\"\n  ... <configure\n  ...     xmlns:z3c=\"http://namespaces.zope.org/z3c\">\n  ...   <z3c:macro\n  ...       template=\"this_file_does_not_exist\"\n  ...       name=\"title\"\n  ...       />\n  ... </configure>\n  ... \"\"\", context=context)\n  Traceback (most recent call last):\n  ...\n  zope.configuration.exceptions.ConfigurationError: ...\n\n\n=======\nCHANGES\n=======\n\n3.0 (2024-01-11)\n----------------\n\n- Add support for Python 3.11, 3.12.\n\n- Drop support for Python 2.7, 3.5, 3.6.\n\n\n2.3 (2021-12-16)\n----------------\n\n- Add support for Python 3.5, 3.8, 3.9, and 3.10.\n\n\n2.2.1 (2018-12-05)\n------------------\n\n- Fix list of supported Python versions in Trove classifiers: The currently\n  supported Python versions are 2.7, 3.6, 3.7, PyPy2 and PyPy3.\n\n- Flake8 the code.\n\n\n2.2.0 (2018-11-13)\n------------------\n\n- Removed Python 3.5 support, added Python 3.7.\n\n- Fixed up tests.\n\n- Fix docstring that caused DeprecationWarning.\n\n\n2.1.0 (2017-10-17)\n------------------\n\n- Drop support for Python 2.6 and 3.3.\n\n- Add support for Python 3.4, 3.5 and 3.6.\n\n- Add support for PyPy.\n\n\n2.0.0 (2015-11-09)\n------------------\n\n- Standardize namespace ``__init__``.\n\n\n2.0.0a1 (2013-02-25)\n--------------------\n\n- Added support for Python 3.3.\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\n1.4.2 (2012-02-15)\n------------------\n\n- Remove hooks to use ViewPageTemplateFile from z3c.pt because this breaks when\n  z3c.pt is available, but z3c.ptcompat is not included. As recommended by notes\n  in 1.4.0 release.\n\n\n1.4.1 (2011-11-15)\n------------------\n\n- bugfix, missing comma in setup install_requires list\n\n\n1.4.0 (2011-10-29)\n------------------\n\n- Moved z3c.pt include to extras_require chameleon. This makes the package\n  independent from chameleon and friends and allows to include this\n  dependencies in your own project.\n\n- Upgrade to chameleon 2.0 template engine and use the newest z3c.pt and\n  z3c.ptcompat packages adjusted to work with chameleon 2.0.\n\n  See the notes from the z3c.ptcompat package:\n\n  Update z3c.ptcompat implementation to use component-based template engine\n  configuration, plugging directly into the Zope Toolkit framework.\n\n  The z3c.ptcompat package no longer provides template classes, or ZCML\n  directives; you should import directly from the ZTK codebase.\n\n  Note that the ``PREFER_Z3C_PT`` environment option has been\n  rendered obsolete; instead, this is now managed via component\n  configuration.\n\n  Also note that the chameleon CHAMELEON_CACHE environment value changed from\n  True/False to a path. Skip this property if you don't like to use a cache.\n  None or False defined in buildout environment section doesn't work. At least\n  with chameleon <= 2.5.4\n\n  Attention: You need to include the configure.zcml file from z3c.ptcompat\n  for enable the z3c.pt template engine. The configure.zcml will plugin the\n  template engine. Also remove any custom built hooks which will import\n  z3c.ptcompat in your tests or other places.\n\n\n1.3.0 (2010-07-05)\n------------------\n\n- Tests now require ``zope.browserpage >= 3.12`` instead of\n  ``zope.app.pagetemplate`` as the expression type registration has\n  been moved there recently.\n\n- No longer using deprecated ``zope.testing.doctestunit`` but built-in\n  ``doctest`` instead.\n\n\n1.2.1 (2009-03-07)\n------------------\n\n- Presence of ``z3c.pt`` is not sufficient to register macro-utility,\n  ``chameleon.zpt`` is required otherwise the factory for the utility\n  is not defined.\n\n\n1.2.0 (2009-03-07)\n------------------\n\n- Allow use of ``z3c.pt`` using ``z3c.ptcompat`` compatibility layer.\n\n- Change package's mailing list address to zope-dev at zope.org.\n\n\n1.1.0 (2007-11-01)\n------------------\n\n- Update package info data.\n\n- Add z3c namespace package declaration.\n\n\n1.0.0 (2007-09-30)\n------------------\n\n- Initial release.\n",
    "bugtrack_url": null,
    "license": "ZPL 2.1",
    "summary": "Simpler definition of ZPT macros.",
    "version": "3.0",
    "project_urls": {
        "Homepage": "https://github.com/zopefoundation/z3c.macro"
    },
    "split_keywords": [
        "zope3",
        "macro",
        "pagetemplate",
        "zpt"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3b1257bc807f8204ec5746948ef82011c99522fbeb2cc3518eb2d0b61f3fc06d",
                "md5": "268c1dbd666ee580042b40c7a946680b",
                "sha256": "2199471dd34c37f47cecee3377d28e9b84c73dcb3796bf5bc5d23c4bd3725117"
            },
            "downloads": -1,
            "filename": "z3c.macro-3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "268c1dbd666ee580042b40c7a946680b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 16128,
            "upload_time": "2024-01-11T07:45:18",
            "upload_time_iso_8601": "2024-01-11T07:45:18.482449Z",
            "url": "https://files.pythonhosted.org/packages/3b/12/57bc807f8204ec5746948ef82011c99522fbeb2cc3518eb2d0b61f3fc06d/z3c.macro-3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a4658a6744f7a57e6187c869fe61380980b8fc26a995734ee7b5c7e0abc3da36",
                "md5": "107f93733182fa15639bccdc7716f1b5",
                "sha256": "ee75e1711b3ddbb66e869e73c502649d28e0461e611b908bf5f95a036fb11d52"
            },
            "downloads": -1,
            "filename": "z3c.macro-3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "107f93733182fa15639bccdc7716f1b5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 16789,
            "upload_time": "2024-01-11T07:45:20",
            "upload_time_iso_8601": "2024-01-11T07:45:20.919325Z",
            "url": "https://files.pythonhosted.org/packages/a4/65/8a6744f7a57e6187c869fe61380980b8fc26a995734ee7b5c7e0abc3da36/z3c.macro-3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-11 07:45:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zopefoundation",
    "github_project": "z3c.macro",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "z3c.macro"
}
        
Elapsed time: 0.25886s