Skip to content

Commit

Permalink
100% test coverage. Badges. setup.cfg for universal wheels.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamadden committed Oct 17, 2017
1 parent 04eaf59 commit 1d8dd15
Show file tree
Hide file tree
Showing 8 changed files with 172 additions and 76 deletions.
11 changes: 11 additions & 0 deletions .coveragerc
@@ -0,0 +1,11 @@
[run]
source = z3c.template

[report]
precision = 2
exclude_lines =
pragma: no cover
if __name__ == '__main__':
raise NotImplementedError
self.fail
raise AssertionError
28 changes: 14 additions & 14 deletions CHANGES.rst
@@ -1,30 +1,30 @@
=======
CHANGES
=======
=========
CHANGES
=========

2.1.0 (unreleased)
------------------
==================

- Add support for PyPy.
- Add support for Python 3.4, 3.5 and 3.6.
- Drop support for Python 2.6 and 3.3.


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

- Standardize namespace __init__


2.0.0a2 (2013-02-25)
--------------------
====================

- Make sure the of the templates content type is a native string instead
forced bytes.


2.0.0a1 (2013-02-22)
--------------------
====================

- Added support for Python 3.3.

Expand All @@ -35,15 +35,15 @@ CHANGES


1.4.1 (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
below.


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
Expand Down Expand Up @@ -76,7 +76,7 @@ CHANGES


1.3.0 (2011-10-28)
------------------
==================

- Update to z3c.ptcompat 1.0 (and as a result, to the z3c.pt 2.x series).

Expand All @@ -85,7 +85,7 @@ CHANGES


1.2.1 (2009-08-22)
------------------
==================

* Corrected description of ``ITemplateDirective.name``.

Expand All @@ -95,7 +95,7 @@ CHANGES


1.2.0 (2009-02-26)
------------------
==================

* Add support for context-specific templates. Now, templates can be
registered and looked up using (view, request, context) triple.
Expand All @@ -111,12 +111,12 @@ CHANGES
instead of retired one.

1.1.0 (2007-10-08)
------------------
==================

* Added an ``IContentTemplate`` interface which is used for
``<z3c:template>``.

1.0.0 (2007-??-??)
------------------
==================

* Initial release.
1 change: 1 addition & 0 deletions MANIFEST.in
Expand Up @@ -4,6 +4,7 @@ include *.py
include buildout.cfg
include tox.ini
include .travis.yml
include .coveragerc

recursive-include src *

Expand Down
24 changes: 20 additions & 4 deletions README.rst
@@ -1,10 +1,26 @@
------------
Z3C template
------------
==============
Z3C template
==============


.. image:: https://img.shields.io/pypi/v/z3c.template.svg
:target: https://pypi.python.org/pypi/z3c.template/
:alt: Latest release

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

.. image:: https://travis-ci.org/zopefoundation/z3c.template.svg?branch=master
:target: https://travis-ci.org/zopefoundation/z3c.template

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


This package allows you to register templates independently from view code.

In Zope 3, when registering a `browser:page` both presentation and computation
In Zope 3, when registering a ``browser:page`` both presentation and computation
are registered together. Unfortunately the registration tangles presentation
and computation so tightly that it is not possible to re-register a different
template depending on context. (You can override the whole registration but
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
@@ -0,0 +1,2 @@
[bdist_wheel]
universal = 1
30 changes: 15 additions & 15 deletions src/z3c/template/README.rst
@@ -1,6 +1,6 @@
=============
Z3C Templates
=============
===============
Z3C Templates
===============

This package allows us to separate the registration of the view code and the
layout.
Expand Down Expand Up @@ -28,7 +28,7 @@ more then one template. Now let's take a look how we an use this templates.


Content template
----------------
================

First let's show how we use a template for produce content from a view:

Expand Down Expand Up @@ -68,7 +68,7 @@ Since the template is not yet registered, rendering the view will fail:
>>> print(view.render())
Traceback (most recent call last):
...
ComponentLookupError: ......
zope.interface.interfaces.ComponentLookupError: ......

Let's now register the template (commonly done using ZCML):

Expand Down Expand Up @@ -142,7 +142,7 @@ registered one.


Layout template
---------------
===============

First we nee to register a new view class calling a layout template. Note,
that this view uses the __call__ method for invoke a layout template:
Expand Down Expand Up @@ -273,7 +273,7 @@ on the view:


Content and Layout
------------------
==================

Now let's show how we combine this two templates in a real use case:

Expand Down Expand Up @@ -347,7 +347,7 @@ Now call the view and check the result:


Macros
------
======

Use of macros.

Expand Down Expand Up @@ -380,7 +380,7 @@ impossible to implement multiple skins using named templates.


Use case ``simple template``
----------------------------
============================

And for the simplest possible use we provide a hook for call registered
templates. Such page templates can get called with the getPageTemplate method
Expand Down Expand Up @@ -423,7 +423,7 @@ created earlier in this test.


Context-specific templates
--------------------------
==========================

The ``TemplateFactory`` can be also used for (view, request, context)
lookup. It's useful when you want to override a template for specific
Expand Down Expand Up @@ -467,7 +467,7 @@ should already use our context-specific template:


Use case ``template by interface``
----------------------------------
==================================

Templates can also get registered on different interfaces then IPageTemplate
or ILayoutTemplate.
Expand Down Expand Up @@ -499,7 +499,7 @@ Now define a view using such a custom template registration:


Use case ``named template``
----------------------------------
===========================

Templates can also get registered on names. In this expample we use a named
template combined with a custom template marker interface.
Expand Down Expand Up @@ -531,7 +531,7 @@ Now define a view using such a custom named template registration:


Use case ``named layout template``
----------------------------------
==================================

We can also register a new layout template by name and use it in a view:

Expand Down Expand Up @@ -571,13 +571,13 @@ Now define a view using such a custom named template registration:


Cleanup
-------
=======

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


Pagelet
-------
=======

See ``z3c.pagelet`` for another template based layout generating implementation.

0 comments on commit 1d8dd15

Please sign in to comment.