Chameleon

Latest version: v4.6.0

Safety actively analyzes 693883 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 16 of 19

2.3

----------------

Features:

- Added support for the following syntax to disable inline evaluation
in a comment:

<!--? comment appears verbatim (no ${...} evaluation) -->

Note that the initial question mark character (?) will be omitted
from output.

- The parser now accepts '<' and '>' in attributes. Note that this is
invalid markup. Previously, the '<' would not be accepted as a valid
attribute value, but this would result in an 'unexpected end tag'
error elsewhere. This fixes issue 38.

- The expression compiler now provides methods ``assign_text`` and
``assign_value`` such that a template engine might configure this
value conversion to support e.g. encoded strings.

Note that currently, the only client for the ``assign_text`` method
is the string expression type.

- Enable template loader for string-based template classes. Note that
the ``filename`` keyword argument may be provided on initialization
to identify the template source by filename. This fixes issue 36.

- Added ``extra_builtins`` option to the page template class. These
builtins are added to the default builtins dictionary at cook time
and may be provided at initialization using the ``extra_builtins``
keyword argument.

Bugfixes:

- If a translation domain is set for a fill slot, use this setting
instead of the macro template domain.

- The Python expression compiler now correctly decodes HTML entities
``'gt'`` and ``'lt'``. This fixes issue 32.

- The string expression compiler now correctly handles encoded text
(when support for encoded strings is enabled). This fixes issue 35.

- Fixed an issue where setting the ``filename`` attribute on a
file-based template would not automatically cause an invalidation.

- Exceptions raised by Chameleon can now be copied via
``copy.copy``. This fixes issue 36.
[leorochael]

- If copying the exception fails in the exception handler, simply
re-raise the original exception and log a warning.

2.2

----------------

Features:

- Added new expression type ``load:`` that allows loading a
template. Both relative and absolute paths are supported. If the
path given is relative, then it will be resolved with respect to the
directory of the template.

- Added support for dynamic evaluation of expressions.

Note that this is to support legacy applications. It is not
currently wired into the provided template classes.

- Template classes now have a ``builtins`` attribute which may be used
to define built-in variables always available in the template
variable scope.

Incompatibilities:

- The file-based template class no longer accepts a parameter
``loader``. This parameter would be used to load a template from a
relative path, using a ``find(filename)`` method. This was however,
undocumented, and probably not very useful since we have the
``TemplateLoader`` mechanism already.

- The compiled template module now contains an ``initialize`` function
which takes values that map to the template builtins. The return
value of this function is a dictionary that contains the render
functions.

Bugfixes:

- The file-based template class no longer verifies the existence of a
template file (using ``os.lstat``). This now happens implicitly if
eager parsing is enabled, or otherwise when first needed (e.g. at
render time).

This is classified as a bug fix because the previous behavior was
probably not what you'd expect, especially if an application
initializes a lot of templates without needing to render them
immediately.

2.1.1

------------------

Features:

- Improved exception display. The expression string is now shown in
the context of the original source (if available) with a marker
string indicating the location of the expression in the template
source.

Bugfixes:

- The ``structure`` insertion mode now correctly decodes entities for
any expression type (including ``string:``). This fixes issue 30.

- Don't show internal variables in the exception formatter variable
listing.

2.1

----------------

Features:

- Expression interpolation (using the ``${...}`` operator and
previously also ``$identifier``) now requires braces everywhere
except inside the ``string:`` expression type.

This change is motivated by a number of legacy templates in which
the interpolation format without braces ``$identifier`` appears as
text.

2.0.2

------------------

Bugfixes:

- Don't use dynamic variable scope for lambda-scoped variables (27).

- Avoid duplication of exception class and message in traceback.

- Fixed issue where a ``metal:fill-slot`` would be ignored if a macro
was set to be used on the same element (16).

2.0.1

------------------

Bugfixes:

- Fixed issue where global variable definition from macro slots would
fail (they would instead be local). This also affects error
reporting from inside slots because this would be recorded
internally as a global.

- Fixed issue with template cache digest (used for filenames); modules
are now invalidated whenever any changes are made to the
distribution set available (packages on ``sys.path``).

- Fixed exception handler to better let exceptions propagate through
the renderer.

- The disk-based module compiler now mangles template source filenames
such that the output Python module is valid and at root level (dots
and hyphens are replaced by an underscore). This fixes issue 17.

- Fixed translations (i18n) on Python 2.5.

Page 16 of 19

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.