Jinja2 template bindings for repoze.bfg
Project description
``repoze.bfg`` bindings for `Jinja2 <http:http://jinja.pocoo.org>`_
===================================================================
These are bindings for the `Jinja2 templating system`_ for the
``repoze.bfg`` web framework.
High-Level API
--------------
The API follows the pattern of the "default" template API for
``repoze.bfg``, which includes three functions: ``get_template``,
``render_template``, and ``render_template_to_response``. From within
a repoze.bfg view function, you might do::
from webob import Response
from repoze.bfg.jinja2 import get_template
template = get_template('templates/foo.jinja2')
return Response(template.render(foo=1))
Or::
from repoze.bfg.jinja2 import render_template
s = render_template('templates/foo.jinja2', foo=1)
return Response(s)
Or::
from repoze.bfg.jinja2 import render_template_to_response
return render_template_to_response('templates/foo.jinja2', foo=1)
All of these examples are equivalent. The first argument passed in to
each of them (representing the template location) can be either a full
system file path, or can be a file path relative to the package in
which the view function is defined (as shown above).
``repoze.bfg.jinja2`` can also act as a "renderer" for a view when its
``configure.zcml`` file is included within the ``repoze.bfg``
application you're developing::
@bfg_view(renderer='templates/foo.jinja2')
def aview(request):
return {'foo':1}
See the generated ``bfg_jinja2_starter`` paster template for an
example of using the renderer facility.
Installation
------------
Install using setuptools, e.g. (within a virtualenv)::
$ easy_install -i http://dist.repoze.org/bfg/dev/simple repoze.bfg.jinja2
Creating a Jinja2 ``repoze.bfg`` Project
----------------------------------------
After you've got ``repoze.bfg.jinja2`` installed, you can invoke the
following command to create a Jinja2-based ``repoze.bfg`` project::
$ paster create -t bin/paster create -t bfg_jinja2_starter
Reporting Bugs / Development Versions
-------------------------------------
Visit http://bugs.repoze.org to report bugs. Visit
http://svn.repoze.org to download development or tagged versions.
Changelog
=========
0.6 (2009-11-30)
----------------
- ``repoze.bfg`` 1.2 compatibility. This package is no longer
compatible with ``repoze.bfg`` 1.1
- Take out dependency on private package index in setup.cfg.
0.5 (2009-11-09)
----------------
- ``repoze.bfg`` 1.1 support including renderer support. Changed
``bfg_jinja2_starter`` paster template to generate a view that uses
a renderer.
- This version is no longer compatible with ``repoze.bfg`` 1.0.X (use
0.4 for BFG 1.0.X compatibility).
0.4 (2009-11-07)
----------------
- Respect ``reload_templates`` option in BFG.
- Don't require ez_setup.py anymore.
- Nosetests no longer does coverage by default.
- This will be the last release will be the last release that will
operate under BFG 1.0. Future versions will operate only under BFG
1.1.
0.3 (2009-05-03)
----------------
- Add a paster template for creating a Jinja2-based ``repoze.bfg``
project. (e.g. ``paster create -t bfg_jinja2_starter``).
0.2 (2009-05-02)
----------------
- Point setup.cfg index_url at http://dist.repoze.org/bfg/dev/simple
0.1 (unknown date)
------------------
- Initial release.
===================================================================
These are bindings for the `Jinja2 templating system`_ for the
``repoze.bfg`` web framework.
High-Level API
--------------
The API follows the pattern of the "default" template API for
``repoze.bfg``, which includes three functions: ``get_template``,
``render_template``, and ``render_template_to_response``. From within
a repoze.bfg view function, you might do::
from webob import Response
from repoze.bfg.jinja2 import get_template
template = get_template('templates/foo.jinja2')
return Response(template.render(foo=1))
Or::
from repoze.bfg.jinja2 import render_template
s = render_template('templates/foo.jinja2', foo=1)
return Response(s)
Or::
from repoze.bfg.jinja2 import render_template_to_response
return render_template_to_response('templates/foo.jinja2', foo=1)
All of these examples are equivalent. The first argument passed in to
each of them (representing the template location) can be either a full
system file path, or can be a file path relative to the package in
which the view function is defined (as shown above).
``repoze.bfg.jinja2`` can also act as a "renderer" for a view when its
``configure.zcml`` file is included within the ``repoze.bfg``
application you're developing::
@bfg_view(renderer='templates/foo.jinja2')
def aview(request):
return {'foo':1}
See the generated ``bfg_jinja2_starter`` paster template for an
example of using the renderer facility.
Installation
------------
Install using setuptools, e.g. (within a virtualenv)::
$ easy_install -i http://dist.repoze.org/bfg/dev/simple repoze.bfg.jinja2
Creating a Jinja2 ``repoze.bfg`` Project
----------------------------------------
After you've got ``repoze.bfg.jinja2`` installed, you can invoke the
following command to create a Jinja2-based ``repoze.bfg`` project::
$ paster create -t bin/paster create -t bfg_jinja2_starter
Reporting Bugs / Development Versions
-------------------------------------
Visit http://bugs.repoze.org to report bugs. Visit
http://svn.repoze.org to download development or tagged versions.
Changelog
=========
0.6 (2009-11-30)
----------------
- ``repoze.bfg`` 1.2 compatibility. This package is no longer
compatible with ``repoze.bfg`` 1.1
- Take out dependency on private package index in setup.cfg.
0.5 (2009-11-09)
----------------
- ``repoze.bfg`` 1.1 support including renderer support. Changed
``bfg_jinja2_starter`` paster template to generate a view that uses
a renderer.
- This version is no longer compatible with ``repoze.bfg`` 1.0.X (use
0.4 for BFG 1.0.X compatibility).
0.4 (2009-11-07)
----------------
- Respect ``reload_templates`` option in BFG.
- Don't require ez_setup.py anymore.
- Nosetests no longer does coverage by default.
- This will be the last release will be the last release that will
operate under BFG 1.0. Future versions will operate only under BFG
1.1.
0.3 (2009-05-03)
----------------
- Add a paster template for creating a Jinja2-based ``repoze.bfg``
project. (e.g. ``paster create -t bfg_jinja2_starter``).
0.2 (2009-05-02)
----------------
- Point setup.cfg index_url at http://dist.repoze.org/bfg/dev/simple
0.1 (unknown date)
------------------
- Initial release.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
repoze.bfg.jinja2-0.6.tar.gz
(29.8 kB
view details)
File details
Details for the file repoze.bfg.jinja2-0.6.tar.gz
.
File metadata
- Download URL: repoze.bfg.jinja2-0.6.tar.gz
- Upload date:
- Size: 29.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd8a7e24b002b9fc2558aa6d7f36b5e4ac1ea46239d243a485d6fa4fc4e2d368 |
|
MD5 | 7dd7c1b0e798ddec461c2720fc82c6e0 |
|
BLAKE2b-256 | 71f8ddcbcdca38243c9d18d58074133fe2bf9c967e16de6aca7997f7d3d177e1 |