django-genshi 1.1.1
Django integration for Genshi
Downloads ↓ | Package Documentation
Latest Version: 1.1.3
Overview
django-genshi is a small wrapper library around Genshi that provides an API similar to django.template. Included are imitations of Context and RequestContext. There is also an implemention of the Django template loader system adapted for Genshi, and a selection of shortcut functions.
Usage
See the Django [1] and Genshi [2] documentation for detailed usage notes. The API of django-genshi is intended to mirror that of Django, while writing or manipulating the templates will require knowledge of Genshi.
Genshi cannot use Django's default template loaders -- to work around this, the app_directories, eggs, and filesystem loaders have been modified and included in the django_genshi.loaders package. Modify your TEMPLATE_LOADERS accordingly.
Example:
>>> from django_genshi import render_to_response
>>> response = render_to_response ('template_name.xml', {"name": "world"})
>>> print response.content
<h1>Hello world!</h1>
| [1] | http://docs.djangoproject.com/en/dev/ref/templates/api/ |
| [2] | http://genshi.edgewall.org/wiki/Documentation |
Output Type Autodetection
Because Genshi is based on abstract markup streams, it is possible for a template to be rendered to multiple output representations (such as HTML or XHTML). The decision of which to render is usually based on the HTTP Accept header. The shortcuts.render_to_response_autodetect function implements a reasonable algorithm for autodetecting output formats, and serves as an example for writing custom encoders in general.
| File | Type | Py Version | Uploaded on | Size | # downloads |
|---|---|---|---|---|---|
| django-genshi-1.1.1.tar.gz (md5, pgp) | Source | 2008-09-27 | 5KB | 381 | |
- Author: John Millikin
- Documentation: django-genshi package documentation
- Home Page: https://launchpad.net/django-genshi
- Download URL: http://pypi.python.org/pypi/django-genshi/1.1.1
- Keywords: django,genshi
- License: MIT
- Platform: Platform Independent
-
Categories
- Development Status :: 4 - Beta
- Framework :: Django
- Intended Audience :: Developers
- License :: OSI Approved :: MIT License
- Operating System :: OS Independent
- Programming Language :: Python
- Topic :: Internet :: WWW/HTTP :: Dynamic Content
- Topic :: Software Development :: Libraries :: Python Modules
- Topic :: Text Processing :: Markup :: HTML
- Topic :: Text Processing :: Markup :: XML
- Package Index Owner: jmillikin
- DOAP record: django-genshi-1.1.1.xml
