- Copyright:
- This document has been placed in the public domain.
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. To avoid conflicts with Django’s template system, place such loaders in the GENSHI_TEMPLATE_LOADERS setting.
Example:
>>> 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.
Filters
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.
Metadata
Release files for django-genshi 1.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-genshi-1.1.3.tar.gz | 6.9 kB | Without provenance | Details for django-genshi-1.1.3.tar.gz |
Release files / django-genshi-1.1.3.tar.gz
| Download URL | django-genshi-1.1.3.tar.gz |
|---|---|
| Size | 6.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3955f7aabff1c3f5ef0eba6e8a461318bd57e300b579f4bd85c82d66676f88dd
|
|
BLAKE2b-256 checksum How to use checksums |
dc02209cb7bddef4d33395286bd80765c4d31b7931d3fb596a7033d33835cdbb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-genshi 1.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.