yamabushi /

Filename Size Date modified Message
tests
yamabushi
88 B
1.0 KB
2.2 KB
352 B
1.9 KB

README

Yamabushi is a Django app that wraps Jinja2. It provides a seamless integration to provide drop in replacements for Django loader functions and generic views.

NAME

"Yamabushi" is a kind of Japanese hermit-monk:

http://en.wikipedia.org/wiki/Yamabushi

REQUIREMENTS

Yamabushi requires Jinja2 (http://jinja.pocoo.org/2/documentation/).

It has been tested with Django 1.1, so if you are running Django 1.0 or earlier please test before deployment.

LICENCE

Yamabushi was developed under the MIT licence.

INSTALLATION

Run setup.py install and add "yamabushi" to your INSTALLED_APPS.

CONFIGURATION

There are a number of Jinja2-specific settings you can add to settings:

JINJA_CACHE_SIZE : size of Jinja2 cache (default=50) JINJA_AUTOESCAPE : auto-escape XHTML/HTML (default=True)

The settings below take a dot-based path name, like for example Django MIDDLEWARE_CLASSES, for example JINJA_FILTERS = ("myapp.filters.some_filter",).

JINJA_GLOBALS : global functions JINJA_FILTERS : filter functions JINJA_TESTS : test functions JINJA_EXTENSIONS : Jinja2 extensions

Note: if jinja2.ext.i18n is added to JINJA_EXTENSIONS it will automatically work with Django gettext.

Jinja2 will automatically look for templates in TEMPLATE_DIRS, as well as templates loaded from your apps.

LOADER

The Yamabushi template loader(yamabushi.template.loader) uses pretty much the same API as Django template loader, for example get_template(), render_to_string(), etc.

Note that the loader functions can take either a Python dict or Django Context.

GENERIC VIEWS

Yamabushi wraps the Django generic views, so that the Yamabushi template loader is used by default instead of the Django template loader.

For example, to use object_list, instead of:

from django.views.generic.list_detail import object_list

use:

from yamabushi.views.generic.list_detail import object_list

RUNNING TESTS

In order to ensure that template information (template name and context) are captured when running unit tests, set the following in your settings:

TEST_RUNNER = 'yamabushi.test.run_tests'

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.