jinja_tornado
jinja2 support for tornado applications.
Install
$ python setup.py install
Usage
from jinja_tornado import JinjaApp, JinjaTemplateMixin
application = tornado.web.Application( ... )
environment = JinjaApp.init_app(application)
"""init_app returns jinja2 environment that is used by application.
takes a dict as second argument which contains your custom jinja 2
settings for environment constructor.
see http://jinja.pocoo.org/docs/api/#jinja2.Environment """
class JinjaEnabledHandler(JinjaTemplateMixin, tornado.web.RequestHandler):
""" this Handler supports
- `self.session` properties (as flask.session) and `session` in template
- `self.render` method
- `self.render_string` method """
# custom filters, tests, globals
environment = JinjaApp.init_app(application)
@environment.filter()
def foo_to_bar(x):
return x.replace('foo', 'bar')
Template variables
request => tornado.web.RequestHandler.request
session => tornado.web.RequestHandler.get_secure_cookie('session')
path_args => tornado.web.RequestHandler.path_args
path_kwargs => tornado.web.RequestHandler.path_kwargs
settings => tornado.web.RequestHandler.application.settings
reverse_url => tornado.web.RequestHandler.application.reverse_url
static_url => tornado.web.RequestHandler.static_url
xsrf_form_html => tornado.web.RequestHandler.xsrf_form_html
datetime => datetime (python module)
locale => tornado.web.RequestHandler.locale
_ => tornado.web.RequestHandler.locale.translate
handler => tornado.web.RequestHandler (self)
current_user => tornado.web.requestHandler.current_user
Template filters
tojson => JSON-encode the given python object
<script>
var obj = {{ obj | tojson | safe }}
</script>
xhtml_escape => tornado.escape.xhtml_escape
url_escape => tornado.escape.url_escape
squeeze => tornado.escape.squeeze
linkify => tornado.escape.linkify
Todo
write tests
no more opinionated session implementation
implement template preprocessors
UIModules, and various ‘tornado’ template structures
License
MIT License. See: LICENSE
History
release/0.1.3 (2020-07-31 21:43:26 -0400)
git log --reverse --pretty=format:'* %s [%h]' v0.1.2..release/0.1.3
MRG: Merge tag ‘v0.1.2’ into develop [dfdd5a0]
REF: jinja_tornado.py: 2to3 py3 [ec31ca0]
RLS: setup.py,__init__.py: v0.1.3 [9d5ded4]
release/0.1.2 (2016-04-28 17:43:11 -0500)
git log --reverse --pretty=format:'* %s [%h]' v0.1.1..release/0.1.2
MRG: Merge tag ‘v0.1.1’ into develop [a78880c]
DOC: README.rst: source link to most recent maintainer [4c55b41]
DOC: setup.py, __init__.py: v0.1.2 [25707e8]
v0.1.1 (2016-04-28 17:38:37 -0500)
git log --reverse --pretty=format:'* %s [%h]' v0.1.0..v0.1.1
MRG: Merge tag ‘vv0.1.0’ into develop [dc7d3e6]
DOC: setup.py: PyPI trove classifiers [1e948a2]
BLD: setup.cfg: [wheel] universal=1 (py2.py3) [e2a35e9]
DOC: setup.py, __init__.py: v0.1.1 [7f3239a]
DOC: HISTORY.rst: git-changelog.py -r release/0.1.1 –hdr=- | pbcopy [616610b]
MRG: Merge branch ‘release/0.1.1’ [34f9b9a]
v0.1.0 (2016-04-28 17:15:48 -0500)
git log --reverse --pretty=format:'* %s [%h]' b8d13ce..v0.1.0
initial commit [2defc31]
2nd commit [c05ab84]
now it is a package [0993866]
fixed __init__ and readme [2f1171e]
Update README.md [f78735d]
Update jinja_tornado.py [6df0211]
Update README.md [01fa568]
REF: README.md -> README.rst [49927dd]
BLD,DOC: Makefile, README.rst, requirements.txt, setup.py: v0.1.0 packaging [d96bdf3]
DOC,BLD: HISTORY.rst, setup.py: add HISTORY.rst to long_description [4fbcb84]
DOC: README.rst: Authors [3f8dd1a]
DOC: setup.py: author, author_email, url [10e837a]
DOC: LICENSE: amend (MIT) LICENSE copyright [0e6641a]
BLD: MANIFEST.in: add MANIFEST.in [746358b]
BLD: Makefile: ‘python setup.py check -r -s’ [d196959]
DOC: HISTORY.rst: git-changelog.py -r release/v0.1.0 –hdr=- | pbcopy [824a131]
BLD: Makefile, requirements[-dev].txt: development requirements [54113b5]
BLD: Makefile: twine register because HTTPS [c4d1535]
DOC: HISTORY.rst: git-changelog.py -r release/v0.1.0 –hdr=- | pbcopy [e3b7d82]
MRG: Merge branch ‘release/v0.1.0’ [bf83680]
Metadata
Release files for jinja-tornado 0.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 |
|---|---|---|---|---|
| jinja_tornado-0.1.3.tar.gz | 8.3 kB | Without provenance | Details for jinja_tornado-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jinja_tornado-0.1.3-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for jinja_tornado-0.1.3-py2.py3-none-any.whl |
Total release size: 14.2 kB
Release files / jinja_tornado-0.1.3.tar.gz
| Download URL | jinja_tornado-0.1.3.tar.gz |
|---|---|
| Size | 8.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ebeabcfce6318e9ce7b88067ace6f2e02cf19d7dbcfa15791982ad2e704756cc
|
|
BLAKE2b-256 checksum How to use checksums |
02ba78a524a94820604b9fb0f068ab16471ba3f6fdba5de6a3b3688eb567f74c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5
|
Release files / jinja_tornado-0.1.3-py2.py3-none-any.whl
| Download URL | jinja_tornado-0.1.3-py2.py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
1f6d0f6a9310fce1e5b6123be685550b53117c180b399c4c80cf94e31bbe5f00
|
|
BLAKE2b-256 checksum How to use checksums |
aed7929a604b02fddc8f98af3acb722facfaab1afe2c44bbc3902bd62a74c77a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5
|
Security for jinja-tornado 0.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.