Skip to main content

Chameleon fetcher

A small wrapper for chameleon (page templates) to easily fetch and render templates.

Installation

pip install chameleon_fetcher

Usage

E.g. you have in template dir my_template_dir a file simple.pt with the following content:

<test>${template_name} ${myvar} ${some_var}</test>

You can then do:

from chameleon_fetcher import ChameleonFetcher

cf = ChameleonFetcher('my_template_dir', some_var=42)
output = cf('simple', myvar='test')
assert output == '<test>simple test 42</test>'

Please note how some_var is set "globally", while for the specific template also a variable myvar is used.

The following parameters are accepted by ChameleonFetcher:

  • template_dir: the directory where the templates are located

And optionally:

  • extension: extension of the template files, defaults to '.pt'
  • boolean_attributes: what boolean attributes should be supported, defaults to {'selected', 'checked'}
  • auto_reload: if the templates should be reloaded on change, defaults to True
  • **kwargs: other params you want to have available in all templates, e.g. flask=flask

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chameleon_fetcher-0.0.1.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chameleon_fetcher-0.0.1-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file chameleon_fetcher-0.0.1.tar.gz.

File metadata

  • Download URL: chameleon_fetcher-0.0.1.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.5

File hashes

Hashes for chameleon_fetcher-0.0.1.tar.gz
Algorithm Hash digest
SHA256 e231081392b7c6fb594c07aeac2c159cfd9b5efdf9aa0a5f16eefc9aa7f85f36
MD5 2c07b2dd1e988e1d30497e5d34bd58b0
BLAKE2b-256 25409c617f4f65ebfd672556733352811e6a6eeb13a8456c22e78d7776edea3d

See more details on using hashes here.

File details

Details for the file chameleon_fetcher-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for chameleon_fetcher-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b078d0dae725dd5f698ef1617e0f442ad2005c5dc2c97cd7ffa6e6bfe378d22f
MD5 08e8042a6de44477407272beab954a29
BLAKE2b-256 6b7a92a67f9fd6be66b276e953a654884347cc3cefab9287068813dbe34a7ab4

See more details on using hashes here.

Release history Release notifications | RSS feed

0.0.2

2 files

This release

0.0.1 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page