django-genshi 1.1.3

Django integration for Genshi


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.


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. To avoid conflicts with Django's template system, place such loaders in the GENSHI_TEMPLATE_LOADERS setting.


>>> from django_genshi import render_to_response
>>> response = render_to_response ('template_name.xml', {"name": "world"})
>>> print response.content
<h1>Hello world!</h1>

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.


Arbitrary Genshi filter functions may be registered, using the GENSHI_TEMPLATE_FILTERS setting. They will be applied to generated template streams by the shortcut functions prior to rendering the streams. Example filters are included in the django_genshi.filters module.



John Millikin




  • Topic :: Text Processing :: Markup :: XML
  • Topic :: Text Processing :: Markup :: HTML
  • Topic :: Software Development :: Libraries :: Python Modules
  • Topic :: Internet :: WWW/HTTP :: Dynamic Content
  • Programming Language :: Python
  • Operating System :: OS Independent
  • License :: OSI Approved :: GNU General Public License (GPL)
  • Intended Audience :: Developers
  • Framework :: Django
  • Development Status :: 4 - Beta
File Type Python Version Uploaded On Downloads
django-genshi-1.1.3.tar.gz Source April 19, 2009 2,515
Version Release Date
1.1.3 April 19, 2009
1.1.2 Sept. 30, 2008
1.1.1 Sept. 27, 2008
1.1.0 Sept. 26, 2008
1.0.0 Sept. 24, 2008
Date Package Version Action
Nov. 4, 2014, 1:15 p.m. django-genshi 1.0.0 Release Created
Nov. 4, 2014, 1:15 p.m. django-genshi 1.1.2 Release Created
Nov. 4, 2014, 1:15 p.m. django-genshi 1.1.3 Release Created
Nov. 4, 2014, 1:15 p.m. django-genshi 1.1.0 Release Created
Nov. 4, 2014, 1:15 p.m. django-genshi 1.1.1 Release Created
Nov. 4, 2014, 1:15 p.m. django-genshi Package Created