Metadata-Version: 1.0
Name: zope.app.pagetemplate
Version: 3.8.0
Summary: PageTemplate integration for Zope 3
Home-page: http://pypi.python.org/pypi/zope.app.pagetemplate
Author: Zope Corporation and Contributors
Author-email: zope-dev@zope.org
License: ZPL 2.1
Description: The ``zope.app.pagetemplate`` package integrates the Page Template
        templating system (``zope.pagetemplate``) into the Zope 3 application
        server.  In particular, it provides:
        
        * a TALES engine implementation that uses Zope's security system for
        checking access,
        
        * a ``ViewPageTemplateFile`` class that can be put on a browser page
        class as an attribute and will function as a callable method whose
        result is the rendered template, e.g.::
        
        from zope.publisher import BrowserPage
        from zope.app.pagetemplate import ViewPageTemplateFile
        
        class HelloWorldPage(BrowserPage):
        __call__ = ViewPageTemplateFile('helloworld.pt')
        
        * TALES namespace adapters for easy access to DublinCore metadata
        (e.g. ``obj/zope:title``) and URL quoting
        (e.g. ``obj/@@absolute_url/url:quote``).
        
        
        
        .. contents::
        
        ===============
        Named Templates
        ===============
        
        We often want to be able to define view logic and view templates
        independently.  We'd like to be able to change the template used by a
        form without being forced to modify the form.
        
        Named templates provide templates that are registered as named view
        adapters.   To define a named template, use the `NamedTemplateImplementation`
        constructor:
        
        >>> from zope.app.pagetemplate import ViewPageTemplateFile
        >>> from zope.app.pagetemplate.namedtemplate import (
        ...     NamedTemplateImplementation)
        >>> sample = ViewPageTemplateFile('tests/namedtemplate.pt')
        >>> sample = NamedTemplateImplementation(sample)
        
        Let's define a view that uses the named template.  To use a named
        template, use the NamedTemplate constructor, and give a template name:
        
        >>> from zope.app.pagetemplate.namedtemplate import NamedTemplate
        >>> class MyView:
        ...     def __init__(self, context, request):
        ...         self.context = context
        ...         self.request = request
        ...
        ...     __call__ = NamedTemplate('sample')
        
        Normally, we'd register a named template for a view interface, to
        allow it to be registered for multiple views.  We'll just register it
        for our view class.
        
        >>> from zope import component
        >>> component.provideAdapter(sample, [MyView], name='sample')
        
        Now, with this in place, we should be able to use our view:
        
        >>> class MyContent:
        ...     def __init__(self, name):
        ...         self.name = name
        
        >>> from zope.publisher.browser import TestRequest
        >>> print MyView(MyContent('bob'), TestRequest())(x=42)
        <html><body>
        Hello bob
        The URL is http://127.0.0.1
        The positional arguments were ()
        The keyword argument x is 42
        </body></html>
        <BLANKLINE>
        
        The view type that a named template is to be used for can be supplied
        when the named template is created:
        
        >>> class MyView:
        ...     def __init__(self, context, request):
        ...         self.context = context
        ...         self.request = request
        ...
        ...     __call__ = NamedTemplate('sample2')
        
        >>> sample = ViewPageTemplateFile('tests/namedtemplate.pt')
        >>> sample = NamedTemplateImplementation(sample, MyView)
        >>> component.provideAdapter(sample, name='sample2')
        >>> print MyView(MyContent('bob'), TestRequest())(x=42)
        <html><body>
        Hello bob
        The URL is http://127.0.0.1
        The positional arguments were ()
        The keyword argument x is 42
        </body></html>
        <BLANKLINE>
        
        
        =======
        Changes
        =======
        
        3.8.0 (2009-12-16)
        ------------------
        
        - Refactored nested macro test from a functional test into a unit test. This
        allowed to remove the last outside zope.app dependencies.
        
        - Fixed undeclared testing dependency on zope.app.component.
        
        - Copy trivial NoTraverser class from zope.app.publication to avoid a ZCML
        dependency on that package.
        
        - Correct testing dependency to point to zope.securitypolicy instead of its
        zope.app variant. The app version is no longer required since 3.4.1.
        
        - Removed the ``inline-evaluation`` extra referring to zope.app.interpreter.
        There's no code or ZCML left pointing to that package.
        
        3.7.1 (2009-05-27)
        ------------------
        
        - Restored ``zope.app.pagetemplate.engine`` module, using BBB imports from
        ``zope.pagetemplate.engine``.
        
        3.7.0 (2009-05-25)
        ------------------
        
        - Moved the ``engine`` module and associated testing machinery to
        ``zope.pagetemplate`` (version 3.5.0).
        
        3.6.0 (2009-05-18)
        ------------------
        
        * Moved ``namedtemplate.*`` from ``zope.formlib`` here as it is more
        about a page template engine than a formular library. This also
        breaks some dependencies on ``zope.formlib``.
        
        * Added doctests to long_description to show up on pypi.
        
        3.5.0 (2009-02-01)
        ------------------
        
        * Use ``zope.container`` instead of ``zope.app.container``.
        
        3.4.1 (2008-07-30)
        ------------------
        
        * Substitute zope.app.zapi by direct calls to its wrapped apis.
        See http://launchpad.net/bugs/219302
        
        * Fix deprecation warning in ftesting.zcml: ZopeSecurityPolicy now lives in
        zope.securitypolicy.
        
        3.4.0 (2007-09-28)
        ------------------
        
        * Initial release as standalone package.
        
        * Dependency on zope.app.interpreter moved to an extra
        [inline-evaluation].  It is only needed by zope.app.pythonpage,
        which is an oddity.
        
Platform: UNKNOWN
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Zope Public License
Classifier: Programming Language :: Python
Classifier: Framework :: Zope3
