Chameleon
=========
.. image:: https://img.shields.io/pypi/pyversions/Chameleon
:alt: PyPI - Python Version
.. image:: https://img.shields.io/github/actions/workflow/status/malthe/chameleon/main.yml
:alt: GitHub Actions Workflow Status
Chameleon is an HTML/XML template engine for `Python
<http://www.python.org>`_. It uses the *page templates* language.
You can use it in any Python application with just about any
version of Python (3.9+ and up, plus `pypy 3
<http://pypy.org>`_).
Visit the `documentation <https://chameleon.readthedocs.io/en/latest/>`_
for more information.
License and Copyright
---------------------
This software is made available as-is under a BSD-like license [1]_
(see included copyright notice).
Notes
-----
.. [1] This software is licensed under the `Repoze
<http://repoze.org/license.html>`_ license.
Changes
=======
4.5.4 (2024-04-08)
------------------
- Fix an issue where $-sign interpolation escaping would not work
correctly when more than two such symbols appeared next to each
other.
(`#422 <https://github.com/malthe/chameleon/issues/422>`_)
4.5.3 (2024-04-05)
------------------
- Minor optimization when rendering translations with a static
message id (don't need to test if it's non-empty).
- Fix a bug where a macro could not be used correctly to render a
translation name.
(`#419 <https://github.com/malthe/chameleon/issues/419>`_)
4.5.2 (2024-01-29)
------------------
- Fix a regression where a static symbol would not get correctly
imported.
(`#414 <https://github.com/malthe/chameleon/issues/414>`_)
4.5.1 (2024-01-28)
------------------
- Add Python 3.13 classifier.
- Fix a regression where `default_extension` was no longer permitted
as a positional argument to `PageTemplateLoader`.
(`#411 <https://github.com/malthe/chameleon/issues/411>`_)
4.5.0 (2024-01-18)
------------------
- Chameleon now has type annotations!
- The list of names previously disallowed for use as variables in
templates such as "int" and "float" has been trimmed significantly,
not because it's a good idea to use such names but because the list
of disallowed names was not exhaustive and complicated the compiler
code; and perhaps more importantly, the technical reason for
disallowing the names in the first place no longer applies.
- Fix a regression where generated template code would suboptimal due
to incorrect handling of internal variables.
- Always cook templates in debug mode, even when using
`CHAMELEON_CACHE` option to persist generated code on disk.
- Parsing the AST back to Python code now uses the built-in
`ast.unparse` function. This change is not directly surfaced but
means that the unparsing code is now more correctly tracking changes
to the interpreter.
- Drop support for platforms where AST nodes aren't weakref-capable
(e.g., older PyPy).
4.4.4 (2024-01-18)
------------------
- Fix a PyPy compatibility issue having to do with determining the set
of versions when some packages (e.g. `cffi`) would not carry a
version.
4.4.3 (2023-12-30)
------------------
- Remove `zope.interface`.
- Fix an issue where `auto_reload` is enabled and a file is loaded
from a package that wasn't zip-compressed.
(`#402 <https://github.com/malthe/chameleon/issues/402>`_)
4.4.2 (2023-12-18)
------------------
- Fix brown bag release.
4.4.1 (2023-12-18)
------------------
- Fix brown bag release.
4.4.0 (2023-12-12)
------------------
- Add optional parameter ``package_name`` which allows loading a
template relative to a package.
- Drop support for Python 3.7.
- Fix regression where Chameleon would not load templates correctly on
Windows.
- Fix names of dependencies for ``importlib_resources`` and
``importlib_metadata``.
(`#394 <https://github.com/malthe/chameleon/pull/394>`_)
4.3.0 (2023-12-04)
------------------
- Local variable scope is now iterable, completing dict interface.
(`#390 <https://github.com/malthe/chameleon/pull/390>`_)
- Minor optimizations to rendering logic.
- Implicit translation now provides the translation context, domain,
and target language to the translation function (if applicable). Previously,
the target language was provided, but this did not respect a change via
`i18n:target`.
(`#369 <https://github.com/malthe/chameleon/issues/369>`_)
- Replace ``pkg_resources`` with newer and faster ``importlib.resources`` and
``importlib.metadata``. Just importing ``pkg_resources`` becomes slower and
slower the more packages are installed.
4.2.0 (2023-09-25)
------------------
- An XML document provided as a string (i.e. decoded) now correctly
has its content encoding parsed.
- Boolean attributes are now automatically configured for templates in
non-XML mode, presuming that we're being used to generate HTML.
This means that the same loading mechanism can be used for both XML-
and HTML-based templates.
4.1.0 (2023-08-29)
------------------
- Boolean attributes (those configured using the optional
`boolean_attributes` parameter) now work with $-expression
interpolation.
Unlike content and regular attributes, a special check for a falsy
value is now done for boolean attributes, such that boolean logic
can be used for interpolation expressions (only a truthy value will
include the attribute).
This reverts a change in behavior introduced in 3.8.0.
Additionally, dynamic attributes now respect the boolean attributes
configuration as well.
4.0.1 (2023-06-19)
------------------
- Fix format spec applying for f-strings.
(`#376 <https://github.com/malthe/chameleon/issues/376>`_)
4.0.0 (2023-03-06)
------------------
- Drop support for Python 2.7, 3.5, 3.6.
- Add support for set- and dict comprehensions
(`#367 <https://github.com/malthe/chameleon/issues/367>`_)
- Remove the following functions resp. modules:
+ ``.utils.text_()``
+ ``.utils.unescape()``
+ ``.compat``
3.10.2 (2022-12-16)
-------------------
- Fix handling of eager compilation with subclassing (e.g. Pyramid integration).
3.10.1 (2022-05-17)
-------------------
- Fix __str__ method of chameleon.exc.TemplateError
(`#356 <https://github.com/malthe/chameleon/issues/356>`_)
3.10.0 (2022-04-06)
-------------------
- Make scope class dict-like
(`#305 <https://github.com/malthe/chameleon/issues/305>`_)
- Work in FIPS enabled environments
(`#345 <https://github.com/malthe/chameleon/issues/345>`_)
- Fix tab handling issue
(`#350 <https://github.com/malthe/chameleon/issues/350>`_)
3.9.1 (2021-05-14)
------------------
- Avoid various traceback reference cycles.
3.9.0 (2021-02-26)
------------------
- Removed compatibility code for unsupported Python versions
- Dropped support for obsolete Python 3.4
- Fixed namespace handling when redefining a variable in the same ``tal:define``
(`#237 <https://github.com/malthe/chameleon/issues/237>`_)
- Fixed failure computing a template's digest if ``template.filename`` is None
(`#254 <https://github.com/malthe/chameleon/issues/254>`_)
3.8.1 (2020-07-06)
------------------
- Added code optimization to reduce sequential appends of static text.
- The `default` symbol in dynamic attributes is now
symbolic. Previously, it was assigned the string value of the
default attribute text. A similar change has been made for
switch/case expressions.
- The built-in `attrs` dictionary of static element attributes now
correctly works with `tal:define`, etc.
- Fix slice code generation compatibility issue on Python 3.9.
3.8.0 (2020-06-25)
------------------
- Expose default marker as importable symbol
`chameleon.tales.DEFAULT_MARKER`.
- Removed legacy flag `literal_false`. To get a similar behavior, use
`boolean_attributes`.
3.7.4 (2020-06-17)
------------------
- Fix brown-bag release.
3.7.3 (2020-06-17)
------------------
- Fix regression introduced in 3.6.2 where the default marker would
incorrectly change its value between templates, causing issues in
software which depends on the value being treated as a global
object.
3.7.2 (2020-05-31)
------------------
- Allow setting a custom value representation function, allowing
custom formatting of variables during exception formatting.
3.7.1 (2020-05-10)
------------------
- Fix compatibility issue with Python 3.9.
3.7.0 (2020-03-26)
------------------
- Fixed garbage collection issue with variable scope objects (issue #301).
- Fixed issue where setting a global variable would not be available
locally.
- A `RepeatDict` no longer inherits from `dict` since it does not
actually provide that interface in a meaningful way.
- Added feature gate `enable_comment_interpolation` which controls
whether expression interpolation is enabled inside HTML comments
(default is enabled).
- Added support for Python 3.6+ f-strings (issue #294).
3.6.2 (2019-06-22)
------------------
- Fix SyntaxWarnings in Python 3.8 resulting from comparing literals with 'is'.
See https://github.com/plone/Products.CMFPlone/issues/2890.
3.6.1 (2019-04-01)
------------------
- Fix limited search expression for illegal double hyphens in HTML
comments to fix issue #289.
3.6 (2019-02-19)
----------------
- Exclude `RuntimeError` (or `RecursionError` when available) from
exception wrapping.
- Fix double dollar '$$' escaping such that a double dollar is always
resolved, either as an interpolation expression, or as an escape
where it is substituted by a single dollar symbol. This is now
consistent with Zope's handling of this character.
Backslash-escaping of dollar-based string interpolation is no longer
supported. The documentation has been updated to reflect this
change.
This fixes issue #283. Note that this reverses some of the changes
introduced to fix issue #265.
- Drop support for Python 3.3.
3.5 (2018-10-17)
----------------
- Add support for Python 3.8.
- Add support for TAL attributes in an XML declaration tag. This fixes
issue #269.
- Add support for custom exception handling for the `tal:on-error`
statement. There is now an option `on_error_handler` available
as a template configuration (issue #266).
- Fix issue where double '$$' escaping would affect non-interpolation
expressions such as the bare '$$' (issue #265).
- Fix an issue where backslash dollar escaping would leave the
backslash character still in place.
3.4 (2018-07-14)
----------------
Bugfixes:
- Fix regression with translations in case of multiple nodes.
3.3 (2018-05-23)
----------------
Bugfixes:
- Reset error token when rendering internal macro calls.
- Fix edge case in exception handler causing recursion.
[MatthewWilkes]
3.2 (2017-10-06)
----------------
Features:
- Add the automatic variable ``macroname`` that's bound to the name of
the executing macro. Fixes https://github.com/malthe/chameleon/issues/238
- A tokenizer can now be configured on the template class. This is
useful in the case where the template file input is modified before
parsing (for example, where some tags are stripped away) such that
token positions need to be offset accordingly for error locations to
be rendered correctly.
- Expression errors now display source marker (previously only
filename, line and column was shown).
- No longer require Python source files to import modules.
[mrh1997]
Optimizations:
- Exception tracking now defers metadata allocation to time of error.
3.1 (2017-02-21)
----------------
Features:
- Add option ``restricted_namespace`` which controls whether to
restrict namespaces to those defined and used by the page template
language.
[hansroh]
Bugs:
- Fixed attribute HTML entity escaping issue where an entity such as
``&`` would be encoded twice.
Optimizations:
- Simplify exception tracking, reducing bytecode size significantly.
- Avoid checking if a static string is ``None`` during expression
interpolation.
3.0 (2016-12-07)
----------------
Bugs:
- Fix issue on Python 2 where an exception was not cleared when using
the pipe operator and was thus accessible through `sys.exc_info()`.
- The "exists" expression no longer leaks error information.
- Escape '$$' into '$' in both content and string expressions.
- Fix use of macro definition inside translation block.
Improvements:
- Allow unquoted attribute values.
- Wrap attribute error thrown when trying to use a non-macro as a
macro as a `RenderError` to get proper error output.
- Throw a parse error if '--' (double hyphen) appears in an XML
comment.
- The `i18n:target` attribute now overrides a default
`target_language` variable and is passed to the translation
function.
- Include filename in the on-disk cache module name. Previously,
only the SHA digest in hex representation would be used, making
it difficult to see where the module came from. This fixes issue
#132.
- Add support for non-ascii attribute names.
[sank]
Compatibility:
- Drop support for Python 2.6, 3.1, and 3.2.
2.25 (2016-09-24)
-----------------
- Add explicit support / testing for Python 3.5.
- Add ``\r`` to negative regex matches to the chameleon parser, where ``\n`` is used but ``\r`` was missing.
Fixes a case, where the tag name was parsed into ``html\r`` instead of ``html``.
Fixes: https://github.com/malthe/chameleon/issues/219
2.24 (2015-10-28)
-----------------
- Fixed Python 3.5 compatibility.
- Fixed brown bag release.
2.23 (2015-10-26)
-----------------
- Added ``enable_data_attributes`` option that allows using HTML5 data
attributes as control attributes instead or in addition to XML
namespace attributes.
2.22 (2015-02-06)
-----------------
- Fix brown bag release.
2.21 (2015-02-06)
-----------------
- Added ``RenderError`` exception which indicates that an error
occurred during the evaluation of an expression.
- Clean up ``TemplateError`` exception implementation.
2.20 (2015-01-12)
-----------------
- Pass ``search_path`` to template class when loaded using
``TemplateLoader`` (or one of the derived classes).
[faassen]
2.19 (2015-01-06)
-----------------
- Fix logging deprecation.
- Fix environment-based configuration logging error.
2.18 (2014-11-03)
-----------------
- Fix minor compilation error.
2.17 (2014-11-03)
-----------------
- Add support for ``i18n:context``.
[wiggy]
- Add missing 'parity' repeat property.
[voxspox]
- Don't modify environment when getting variables from it.
[fschulze]
2.16 (2014-05-06)
-----------------
- If a repeat expression evaluates to ``None`` then it is now
equivalent to an empty set.
This changes a behavior introduced in 2.14.
This fixes issue #172.
- Remove fossil test dependency on deprecated ``distribute``.
- Add explicit support / testing for Python 3.3 / 3.4.
- Drop explicit support for Python 2.5 (out of maintenance, and no longer
supported by ``tox`` or ``Travis-CI``).
2.15 (2014-03-11)
-----------------
- Add Support for Python 3.4's ``NameConstant``.
[brakhane]
2.14 (2013-11-28)
-----------------
- Element repetition using the ``TAL`` namespace no longer includes
whitespace. This fixes issue #110.
- Use absolute import for ``chameleon.interfaces`` module. This fixes
issue #161.
2.13-1 (2013-10-24)
-------------------
- Fixing brown bag release.
2.13 (2013-10-21)
-----------------
Bugfixes:
- The template cache mechanism now includes additional configuration
settings as part of the cache key such as ``strict`` and
``trim_attribute_space``.
[ossmkitty]
- Fix cache issue where sometimes cached templates would not load
correctly.
[ossmkitty]
- In debug-mode, correctly remove temporary files when the module
loader is garbage-collected (on ``__del__``).
[graffic]
- Fix error message when duplicate i18n:name directives are used in a
translation.
- Using the three-argument form of ``getattr`` on a
``chameleon.tal.RepeatDict`` no longer raises ``KeyError``,
letting the default provided to ``getattr`` be used. This fixes
attempting to adapt a ``RepeatDict`` to a Zope interface under
PyPy.
2.12 (2013-03-26)
-----------------
Changes:
- When a ``tal:case`` condition succeeds, no other case now will.
Bugfixes:
- Implicit translation now correctly extracts and normalizes complete
sentences, instead of words.
[witsch]
- The ``default`` symbol in a ``tal:case`` condition now allows the
element only if no other case succeeds.
2.11 (2012-11-15)
-----------------
Bugfixes:
- An issue was resolved where a METAL statement was combined with a
``tal:on-error`` handler.
- Fix minor parser issue with incorrectly formatted processing
instructions.
- Provide proper error handling for Python inline code blocks.
Features:
- The simple translation function now supports the
``translationstring`` interface.
Optimizations:
- Minor optimization which correctly detects when an element has no
attributes.
2.10 (2012-10-12)
-----------------
Deprecations:
- The ``fast_translate`` function has been deprecated. Instead, the
default translation function is now always a function that simply
interpolates the mapping onto the message default or id.
The motivation is that since version 2.9, the ``context`` argument
is non-trivial: the ``econtext`` mapping is passed. This breaks an
expectation on the Zope platform that the ``context`` parameter is
the HTTP request. Previously, with Chameleon this parameter was
simply not provided and so that did not cause issues as such.
- The ``ast24`` module has been renamed to ``ast25``. This should help
clear up any confusion that Chameleon 2.x might be support a Python
interpreter less than version 2.5 (it does not).
Features:
- The ``ProxyExpr`` expression class (and hence the ``load:``
expression type) is now a TALES-expression. In practical terms, this
means that the expression type (which computes a string result using
the standard ``"${...}"`` interpolation syntax and proxies the
result through a function) now supports fallback using the pipe
operator (``"|"``). This fixes issue #128.
- An attempt to interpolate using the empty string as the expression
(i.e. ``${}``) now does nothing: the string ``${}`` is simply output
as is.
- Added support for adding, modifying, and removing attributes using a
dictionary expression in ``tal:attributes`` (analogous to Genshi's
``py:attrs`` directive)::
<div tal:attributes="name value; attrs" />
In the example above, ``name`` is an identifier, while ``value`` and
``attrs`` are Python expressions. However, ``attrs`` must evaluate
to a Python dictionary object (more concisely, the value must
implement the dictionary API-methods ``update()`` and ``items()``).
Optimizations:
- In order to cut down on the size of the compiled function objects,
some conversion and quoting statements have been put into
functions. In one measurement, the reduction was 35%. The benchmark
suite does *not* report of an increased render time (actually
slightly decreased).
Bugfixes:
- An exception is now raised if a trivial string is passed for
``metal:fill-slot``. This fixes issue #89.
- An empty string is now never translated. Not really a bug, but it's
been reported in as an issue (#92) because some translation
frameworks handle this case incorrectly.
- The template module loader (file cache) now correctly encodes
generated template source code as UTF-8. This fixes issue #125.
- Fixed issue where a closure might be reused unsafely in nested
template rendering.
- Fixed markup class ``__repr__`` method. This fixes issue #124.
- Added missing return statement to fix printing the non-abbreviated
filename in case of an exception.
[tomo]
2.9.2 (2012-06-06)
------------------
Bugfixes:
- Fixed a PyPy incompatibility.
- Fixed issue #109 which caused testing failures on some platforms.
2.9.1 (2012-06-01)
------------------
Bugfixes:
- Fixed issue #103. The ``tal:on-error`` statement now always adds an
explicit end-tag to the element, even with a substitution content of
nothing.
- Fixed issue #113. The ``tal:on-error`` statement now works correctly
also for dynamic attributes. That is, the fallback tag now includes
only static attributes.
- Fixed name error which prevented the benchmark from running
correctly.
Compatibility:
- Fixed deprecation warning on Python 3 for zope interface implements
declaration. This fixes issue #116.
2.9.0 (2012-05-31)
------------------
Features:
- The translation function now gets the ``econtext`` argument as the
value for ``context``. Note that historically, this was usually an
HTTP request which might provide language negotiation data through a
dictionary interface.
[alvinyue]
Bugfixes:
- Fixed import alias issue which would lead to a syntax error in
generated Python code. Fixes issue #114.
2.8.5 (2012-05-02)
------------------
Bugfixes:
- Fixed minor installation issues on Python 2.5 and 3.
[ppaez]
- Ensure output is unicode even when trivial (an empty string).
2.8.4 (2012-04-18)
------------------
Features:
- In exception output, long filenames are now truncated to 60
characters of output, preventing line wrap which makes it difficult
to scan the exception output.
Bugfixes:
- Include filename and location in exception output for exceptions
raised during compilation.
- If a trivial translation substitution variable is given (i.e. an
empty string), simply ignore it. This fixes issue #106.
2.8.3 (2012-04-16)
------------------
Features:
- Log template source on debug-level before cooking.
- The `target_language` argument, if given, is now available as a
variable in templates.
2.8.2 (2012-03-30)
------------------
Features:
- Temporary caches used in debug mode are cleaned up eagerly, rather
than waiting for process termination.
[mitchellrj]
Bugfixes:
- The `index`, `start` and `end` methods on the TAL repeat object are
now callable. This fixes an incompatibility with ZPT.
- The loader now correctly handles absolute paths on Windows.
[rdale]
2.8.1 (2012-03-29)
------------------
Features:
- The exception formatter now lists errors in 'wrapping order'. This
means that the innermost, and presumably most relevant exception is
shown last.
Bugfixes:
- The exception formatter now correctly recognizes nested errors and
does not rewrap the dynamically generated exception class.
- The exception formatter now correctly sets the ``__module__``
attribute to that of the original exception class.
2.8.0 (2012-02-29)
------------------
Features:
- Added support for code blocks using the `<?python ... ?>` processing
instruction syntax.
The scope is name assignments is up until the nearest macro
definition, or the template itself if macros are not used.
Bugfixes:
- Fall back to the exception class' ``__new__`` method to safely
create an exception object that is not implemented in Python.
- The exception formatter now keeps track of already formatted
exceptions, and ignores them from further output.
2.7.4 (2012-02-27)
------------------
- The error handler now invokes the ``__init__`` method of
``BaseException`` instead of the possibly overridden method (which
may take required arguments). This fixes issue #97.
[j23d, malthe]
2.7.3 (2012-01-16)
------------------
Bugfixes:
- The trim whitespace option now correctly trims actual whitespace to
a single character, appearing either to the left or to the right of
an element prefix or suffix string.
2.7.2 (2012-01-08)
------------------
Features:
- Added option ``trim_attribute_space`` that decides whether attribute
whitespace is stripped (at most down to a single space). This option
exists to provide compatibility with the reference
implementation. Fixes issue #85.
Bugfixes:
- Ignore unhashable builtins when generating a reverse builtin
map to quickly look up a builtin value.
[malthe]
- Apply translation mapping even when a translation function is not
available. This fixes issue #83.
[malthe]
- Fixed issue #80. The translation domain for a slot is defined by the
source document, i.e. the template providing the content for a slot
whether it be the default or provided through ``metal:fill-slot``.
[jcbrand]
- In certain circumstances, a Unicode non-breaking space character would cause
a define clause to fail to parse.
2.7.1 (2011-12-29)
------------------
Features:
- Enable expression interpolation in CDATA.
- The page template class now implements dictionary access to macros::
template[name]
This is a short-hand for::
template.macros[name]
Bugfixes:
- An invalid define clause would be silently ignored; we now raise a
language error exception. This fixes issue #79.
- Fixed regression where ``${...}`` interpolation expressions could
not span multiple lines. This fixes issue #77.
2.7.0 (2011-12-13)
------------------
Features:
- The ``load:`` expression now derives from the string expression such
that the ``${...}`` operator can be used for expression
interpolation.
- The ``load:`` expression now accepts asset specs; these are resolved
by the ``pkg_resources.resource_filename`` function::
<package_name>:<path>
An example from the test suite::
chameleon:tests/inputs/hello_world.pt
Bugfixes:
- If an attribute name for translation was not a valid Python
identifier, the compiler would generate invalid code. This has been
fixed, and the compiler now also throws an exception if an attribute
specification contains a comma. (Note that the only valid separator
character is the semicolon, when specifying attributes for
translation via the ``i18n:translate`` statement). This addresses
issue #76.
2.6.2 (2011-12-08)
------------------
Bugfixes:
- Fixed issue where ``tal:on-error`` would not respect
``tal:omit-tag`` or namespace elements which are omitted by default
(such as ``<tal:block />``).
- Fixed issue where ``macros`` attribute would not be available on
file-based templates due to incorrect initialization.
- The ``TryExcept`` and ``TryFinally`` AST nodes are not available on
Python 3.3. These have been aliased to ``Try``. This fixes issue
#75.
Features:
- The TAL repeat item now makes a security declaration that grants
access to unprotected subobjects on the Zope 2 platform::
__allow_access_to_unprotected_subobjects__ = True
This is required for legacy compatibility and does not affect other
environments.
- The template object now has a method ``write(body)`` which
explicitly decodes and cooks a string input.
- Added configuration option ``loader_class`` which sets the class
used to create the template loader object.
The class (essentially a callable) is created at template
construction time.
2.6.1 (2011-11-30)
------------------
Bugfixes:
- Decode HTML entities in expression interpolation strings. This fixes
issue #74.
- Allow ``xml`` and ``xmlns`` attributes on TAL, I18N and METAL
namespace elements. This fixes issue #73.
2.6.0 (2011-11-24)
------------------
Features:
- Added support for implicit translation:
The ``implicit_i18n_translate`` option enables implicit translation
of text. The ``implicit_i18n_attributes`` enables implicit
translation of attributes. The latter must be a set and for an
attribute to be implicitly translated, its lowercase string value
must be included in the set.
- Added option ``strict`` (enabled by default) which decides whether
expressions are required to be valid at compile time. That is, if
not set, an exception is only raised for an invalid expression at
evaluation time.
- An expression error now results in an exception only if the
expression is attempted evaluated during a rendering.
- Added a configuration option ``prepend_relative_search_path`` which
decides whether the path relative to a file-based template is
prepended to the load search path. The default is ``True``.
- Added a configuration option ``search_path`` to the file-based
template class, which adds additional paths to the template load
instance bound to the ``load:`` expression. The option takes a
string path or an iterable yielding string paths. The default value
is the empty set.
Bugfixes:
- Exception instances now support pickle/unpickle.
- An attributes in i18n:attributes no longer needs to match an
existing or dynamic attribute in order to appear in the
element. This fixes issue #66.
2.5.3 (2011-10-23)
------------------
Bugfixes:
- Fixed an issue where a nested macro slot definition would fail even
though there existed a parent macro definition. This fixes issue
#69.
2.5.2 (2011-10-12)
------------------
Bugfixes:
- Fixed an issue where technically invalid input would result in a
compiler error.
Features:
- The markup class now inherits from the unicode string type such that
it's compatible with the string interface.
2.5.1 (2011-09-29)
------------------
Bugfixes:
- The symbol names "convert", "decode" and "translate" are now no
longer set as read-only *compiler internals*. This fixes issue #65.
- Fixed an issue where a macro extension chain nested two levels (a
template uses a macro that extends a macro) would lose the middle
slot definitions if slots were defined nested.
The compiler now throws an error if a nested slot definition is used
outside a macro extension context.
2.5.0 (2011-09-23)
------------------
Features:
- An expression type ``structure:`` is now available which wraps the
expression result as *structure* such that it is not escaped on
insertion, e.g.::
<div id="content">
${structure: context.body}
</div>
This also means that the ``structure`` keyword for ``tal:content``
and ``tal:replace`` now has an alternative spelling via the
expression type ``structure:``.
- The string-based template constructor now accepts encoded input.
2.4.6 (2011-09-23)
------------------
Bugfixes:
- The ``tal:on-error`` statement should catch all exceptions.
- Fixed issue that would prevent escaping of interpolation expression
values appearing in text.
2.4.5 (2011-09-21)
------------------
Bugfixes:
- The ``tal:on-error`` handler should have a ``error`` variable
defined that has the value of the exception thrown.
- The ``tal:on-error`` statement is a substitution statement and
should support the "text" and "structure" insertion methods.
2.4.4 (2011-09-15)
------------------
Bugfixes:
- An encoding specified in the XML document preamble is now read and
used to decode the template input to unicode. This fixes issue #55.
- Encoded expression input on Python 3 is now correctly
decoded. Previously, the string representation output would be
included instead of an actually decoded string.
- Expression result conversion steps are now correctly included in
error handling such that the exception output points to the
expression location.
2.4.3 (2011-09-13)
------------------
Features:
- When an encoding is provided, pass the 'ignore' flag to avoid
decoding issues with bad input.
Bugfixes:
- Fixed pypy compatibility issue (introduced in previous release).
2.4.2 (2011-09-13)
------------------
Bugfixes:
- Fixed an issue in the compiler where an internal variable (such as a
translation default value) would be cached, resulting in variable
scope corruption (see issue #49).
2.4.1 (2011-09-08)
------------------
Bugfixes:
- Fixed an issue where a default value for an attribute would
sometimes spill over into another attribute.
- Fixed issue where the use of the ``default`` name in an attribute
interpolation expression would print the attribute value. This is
unexpected, because it's an expression, not a static text suitable
for output. An attribute value of ``default`` now correctly drops
the attribute.
2.4.0 (2011-08-22)
------------------
Features:
- Added an option ``boolean_attributes`` to evaluate and render a
provided set of attributes using a boolean logic: if the attribute
is a true value, the value will be the attribute name, otherwise the
attribute is dropped.
In the reference implementation, the following attributes are
configured as boolean values when the template is rendered in
HTML-mode::
"compact", "nowrap", "ismap", "declare", "noshade",
"checked", "disabled", "readonly", "multiple", "selected",
"noresize", "defer"
Note that in Chameleon, these attributes must be manually provided.
Bugfixes:
- The carriage return character (used on Windows platforms) would
incorrectly be included in Python comments.
It is now replaced with a line break.
This fixes issue #44.
2.3.8 (2011-08-19)
------------------
- Fixed import error that affected Python 2.5 only.
2.3.7 (2011-08-19)
------------------
Features:
- Added an option ``literal_false`` that disables the default behavior
of dropping an attribute for a value of ``False`` (in addition to
``None``). This modified behavior is the behavior exhibited in
reference implementation.
Bugfixes:
- Undo attribute special HTML attribute behavior (see previous
release).
This turned out not to be a compatible behavior; rather, boolean
values should simply be coerced to a string.
Meanwhile, the reference implementation does support an HTML mode in
which the special attribute behavior is exhibited.
We do not currently support this mode.
2.3.6 (2011-08-18)
------------------
Features:
- Certain HTML attribute names now have a special behavior for a
attribute value of ``True`` (or ``default`` if no default is
defined). For these attributes, this return value will result in the
name being printed as the value::
<input type="input" tal:attributes="checked True" />
will be rendered as::
<input type="input" checked="checked" />
This behavior is compatible with the reference implementation.
2.3.5 (2011-08-18)
------------------
Features:
- Added support for the set operator (``{item, item, ...}``).
Bugfixes:
- If macro is defined on the same element as a translation name, this
no longer results in a "translation name not allowed outside
translation" error. This fixes issue #43.
- Attribute fallback to dictionary lookup now works on multiple items
(e.g. ``d1.d2.d2``). This fixes issue #42.
2.3.4 (2011-08-16)
------------------
Features:
- When inserting content in either attributes or text, a value of
``True`` (like ``False`` and ``None``) will result in no
action.
- Use statically assigned variables for ``"attrs"`` and
``"default"``. This change yields a performance improvement of
15-20%.
- The template loader class now accepts an optional argument
``default_extension`` which accepts a filename extension which will
be appended to the filename if there's not already an extension.
Bugfixes:
- The default symbol is now ``True`` for an attribute if the attribute
default is not provided. Note that the result is that the attribute
is dropped. This fixes issue #41.
- Fixed an issue where assignment to a variable ``"type"`` would
fail. This fixes issue #40.
- Fixed an issue where an (unsuccessful) assignment for a repeat loop
to a compiler internal name would not result in an error.
- If the translation function returns the identical object, manually
coerce it to string. This fixes a compatibility issue with
translation functions which do not convert non-string objects to a
string value, but simply return them unchanged.
2.3.3 (2011-08-15)
------------------
Features:
- The ``load:`` expression now passes the initial keyword arguments to
its template loader (e.g. ``auto_reload`` and ``encoding``).
- In the exception output, string variable values are now limited to a
limited output of characters, single line only.
Bugfixes:
- Fixed horizontal alignment of exception location info
(i.e. 'String:', 'Filename:' and 'Location:') such that they match
the template exception formatter.
2.3.2 (2011-08-11)
------------------
Bugfixes:
- Fixed issue where i18n:domain would not be inherited through macros
and slots. This fixes issue #37.
2.3.1 (2011-08-11)
------------------
Features:
- The ``Builtin`` node type may now be used to represent any Python
local or global name. This allows expression compilers to refer to
e.g. ``get`` or ``getitem``, or to explicit require a builtin object
such as one from the ``extra_builtins`` dictionary.
Bugfixes:
- Builtins which are not explicitly disallowed may now be redefined
and used as variables (e.g. ``nothing``).
- Fixed compiler issue with circular node annotation loop.
2.3 (2011-08-10)
----------------
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 (2011-07-28)
----------------
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 (2011-07-28)
------------------
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 (2011-07-25)
----------------
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 (2011-07-25)
------------------
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 (2011-07-23)
------------------
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.
2.0 (2011-07-14)
----------------
- Point release.
2.0-rc14 (2011-07-13)
---------------------
Bugfixes:
- The tab character (``\t``) is now parsed correctly when used inside
tags.
Features:
- The ``RepeatDict`` class now works as a proxy behind a separate
dictionary instance.
- Added template constructor option ``keep_body`` which is a flag
(also available as a class attribute) that controls whether to save
the template body input in the ``body`` attribute.
This is disabled by default, unless debug-mode is enabled.
- The page template loader class now accepts an optional ``formats``
argument which can be used to select an alternative template class.
2.0-rc13 (2011-07-07)
---------------------
Bugfixes:
- The backslash character (followed by optional whitespace and a line
break) was not correctly interpreted as a continuation for Python
expressions.
Features:
- The Python expression implementation is now more flexible for
external subclassing via a new ``parse`` method.
2.0-rc12 (2011-07-04)
---------------------
Bugfixes:
- Initial keyword arguments passed to a template now no longer "leak"
into the template variable space after a macro call.
- An unexpected end tag is now an unrecoverable error.
Features:
- Improve exception output.
2.0-rc11 (2011-05-26)
---------------------
Bugfixes:
- Fixed issue where variable names that begin with an underscore were
seemingly allowed, but their use resulted in a compiler error.
Features:
- Template variable names are now allowed to be prefixed with a single
underscore, but not two or more (reserved for internal use).
Examples of valid names::
item
ITEM
_item
camelCase
underscore_delimited
help
- Added support for Genshi's comment "drop" syntax::
<!--! This comment will be dropped -->
Note the additional exclamation (!) character.
This fixes addresses issue #10.
2.0-rc10 (2011-05-24)
---------------------
Bugfixes:
- The ``tal:attributes`` statement now correctly operates
case-insensitive. The attribute name given in the statement will
replace an existing attribute with the same name, without respect to
case.
Features:
- Added ``meta:interpolation`` statement to control expression
interpolation setting.
Strings that disable the setting: ``"off"`` and ``"false"``.
Strings that enable the setting: ``"on"`` and ``"true"``.
- Expression interpolation now works inside XML comments.
2.0-rc9 (2011-05-05)
--------------------
Features:
- Better debugging support for string decode and conversion. If a
naive join fails, each element in the output will now be attempted
coerced to unicode to try and trigger the failure near to the bad
string.
2.0-rc8 (2011-04-11)
--------------------
Bugfixes:
- If a macro defines two slots with the same name, a caller will now
fill both with a single usage.
- If a valid of ``None`` is provided as the translation function
argument, we now fall back to the class default.
2.0-rc7 (2011-03-29)
--------------------
Bugfixes:
- Fixed issue with Python 2.5 compatibility AST. This affected at
least PyPy 1.4.
Features:
- The ``auto_reload`` setting now defaults to the class value; the
base template class gives a default value of
``chameleon.config.AUTO_RELOAD``. This change allows a subclass to
provide a custom default value (such as an application-specific
debug mode setting).
2.0-rc6 (2011-03-19)
--------------------
Features:
- Added support for ``target_language`` keyword argument to render
method. If provided, the argument will be curried onto the
translation function.
Bugfixes:
- The HTML entities 'lt', 'gt' and 'quot' appearing inside content
subtition expressions are now translated into their native character
values. This fixes an issue where you could not dynamically create
elements using the ``structure`` (which is possible in ZPT). The
need to create such structure stems from the lack of an expression
interpolation operator in ZPT.
- Fixed duplicate file pointer issue with test suite (affected Windows
platforms only). This fixes issue #9.
[oliora]
- Use already open file using ``os.fdopen`` when trying to write out
the module source. This fixes LP #731803.
2.0-rc5 (2011-03-07)
--------------------
Bugfixes:
- Fixed a number of issues concerning the escaping of attribute
values:
1) Static attribute values are now included as they appear in the
source.
This means that invalid attribute values such as ``"true &&
false"`` are now left alone. It's not the job of the template
engine to correct such markup, at least not in the default mode
of operation.
2) The string expression compiler no longer unescapes
values. Instead, this is left to each expression
compiler. Currently only the Python expression compiler unescapes
its input.
3) The dynamic escape code sequence now correctly only replaces
ampersands that are part of an HTML escape format.
Imports:
- The page template classes and the loader class can now be imported
directly from the ``chameleon`` module.
Features:
- If a custom template loader is not provided, relative paths are now
resolved using ``os.abspath`` (i.e. to the current working
directory).
- Absolute paths are normalized using ``os.path.normpath`` and
``os.path.expanduser``. This ensures that all paths are kept in
their "canonical" form.
2.0-rc4 (2011-03-03)
--------------------
Bugfixes:
- Fixed an issue where the output of an end-to-end string expression
would raise an exception if the expression evaluated to ``None`` (it
should simply output nothing).
- The ``convert`` function (which is configurable on the template
class level) now defaults to the ``translate`` function (at
run-time).
This fixes an issue where message objects were not translated (and
thus converted to a string) using the a provided ``translate``
function.
- Fixed string interpolation issue where an expression immediately
succeeded by a right curly bracket would not parse.
This fixes issue #5.
- Fixed error where ``tal:condition`` would be evaluated after
``tal:repeat``.
Features:
- Python expression is now a TALES expression. That means that the
pipe operator can be used to chain two or more expressions in a
try-except sequence.
This behavior was ported from the 1.x series. Note that while it's
still possible to use the pipe character ("|") in an expression, it
must now be escaped.
- The template cache can now be shared by multiple processes.
2.0-rc3 (2011-03-02)
--------------------
Bugfixes:
- Fixed ``atexit`` handler.
This fixes issue #3.
- If a cache directory is specified, it will now be used even when not
in debug mode.
- Allow "comment" attribute in the TAL namespace.
This fixes an issue in the sense that the reference engine allows
any attribute within the TAL namespace. However, only "comment" is
in common use.
- The template constructor now accepts a flag ``debug`` which puts the
template *instance* into debug-mode regardless of the global
setting.
This fixes issue #1.
Features:
- Added exception handler for exceptions raised while evaluating an
expression.
This handler raises (or attempts to) a new exception of the type
``RenderError``, with an additional base class of the original
exception class. The string value of the exception is a formatted
error message which includes the expression that caused the
exception.
If we are unable to create the exception class, the original
exception is re-raised.
2.0-rc2 (2011-02-28)
--------------------
- Fixed upload issue.
2.0-rc1 (2011-02-28)
--------------------
- Initial public release. See documentation for what's new in this
series.
Raw data
{
"_id": null,
"home_page": "https://chameleon.readthedocs.io",
"name": "Chameleon",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": null,
"author": "Malthe Borch",
"author_email": "mborch@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/00/d0/c686d98510ce9ed5764284c119ec16959c67ac295928673f970df0dc4d4a/Chameleon-4.5.4.tar.gz",
"platform": null,
"description": "Chameleon\n=========\n\n.. image:: https://img.shields.io/pypi/pyversions/Chameleon\n :alt: PyPI - Python Version\n.. image:: https://img.shields.io/github/actions/workflow/status/malthe/chameleon/main.yml\n :alt: GitHub Actions Workflow Status\n\nChameleon is an HTML/XML template engine for `Python\n<http://www.python.org>`_. It uses the *page templates* language.\n\nYou can use it in any Python application with just about any\nversion of Python (3.9+ and up, plus `pypy 3\n<http://pypy.org>`_).\n\nVisit the `documentation <https://chameleon.readthedocs.io/en/latest/>`_\nfor more information.\n\nLicense and Copyright\n---------------------\n\nThis software is made available as-is under a BSD-like license [1]_\n(see included copyright notice).\n\n\nNotes\n-----\n\n.. [1] This software is licensed under the `Repoze\n <http://repoze.org/license.html>`_ license.\n\n\nChanges\n=======\n\n4.5.4 (2024-04-08)\n------------------\n\n- Fix an issue where $-sign interpolation escaping would not work\n correctly when more than two such symbols appeared next to each\n other.\n (`#422 <https://github.com/malthe/chameleon/issues/422>`_)\n\n4.5.3 (2024-04-05)\n------------------\n\n- Minor optimization when rendering translations with a static\n message id (don't need to test if it's non-empty).\n\n- Fix a bug where a macro could not be used correctly to render a\n translation name.\n (`#419 <https://github.com/malthe/chameleon/issues/419>`_)\n\n4.5.2 (2024-01-29)\n------------------\n\n- Fix a regression where a static symbol would not get correctly\n imported.\n (`#414 <https://github.com/malthe/chameleon/issues/414>`_)\n\n4.5.1 (2024-01-28)\n------------------\n\n- Add Python 3.13 classifier.\n\n- Fix a regression where `default_extension` was no longer permitted\n as a positional argument to `PageTemplateLoader`.\n (`#411 <https://github.com/malthe/chameleon/issues/411>`_)\n\n4.5.0 (2024-01-18)\n------------------\n\n- Chameleon now has type annotations!\n\n- The list of names previously disallowed for use as variables in\n templates such as \"int\" and \"float\" has been trimmed significantly,\n not because it's a good idea to use such names but because the list\n of disallowed names was not exhaustive and complicated the compiler\n code; and perhaps more importantly, the technical reason for\n disallowing the names in the first place no longer applies.\n\n- Fix a regression where generated template code would suboptimal due\n to incorrect handling of internal variables.\n\n- Always cook templates in debug mode, even when using\n `CHAMELEON_CACHE` option to persist generated code on disk.\n\n- Parsing the AST back to Python code now uses the built-in\n `ast.unparse` function. This change is not directly surfaced but\n means that the unparsing code is now more correctly tracking changes\n to the interpreter.\n\n- Drop support for platforms where AST nodes aren't weakref-capable\n (e.g., older PyPy).\n\n\n4.4.4 (2024-01-18)\n------------------\n\n- Fix a PyPy compatibility issue having to do with determining the set\n of versions when some packages (e.g. `cffi`) would not carry a\n version.\n\n\n4.4.3 (2023-12-30)\n------------------\n\n- Remove `zope.interface`.\n\n- Fix an issue where `auto_reload` is enabled and a file is loaded\n from a package that wasn't zip-compressed.\n (`#402 <https://github.com/malthe/chameleon/issues/402>`_)\n\n\n4.4.2 (2023-12-18)\n------------------\n\n- Fix brown bag release.\n\n\n4.4.1 (2023-12-18)\n------------------\n\n- Fix brown bag release.\n\n\n4.4.0 (2023-12-12)\n------------------\n\n- Add optional parameter ``package_name`` which allows loading a\n template relative to a package.\n\n- Drop support for Python 3.7.\n\n- Fix regression where Chameleon would not load templates correctly on\n Windows.\n\n- Fix names of dependencies for ``importlib_resources`` and\n ``importlib_metadata``.\n (`#394 <https://github.com/malthe/chameleon/pull/394>`_)\n\n\n4.3.0 (2023-12-04)\n------------------\n\n- Local variable scope is now iterable, completing dict interface.\n (`#390 <https://github.com/malthe/chameleon/pull/390>`_)\n\n- Minor optimizations to rendering logic.\n\n- Implicit translation now provides the translation context, domain,\n and target language to the translation function (if applicable). Previously,\n the target language was provided, but this did not respect a change via\n `i18n:target`.\n (`#369 <https://github.com/malthe/chameleon/issues/369>`_)\n\n- Replace ``pkg_resources`` with newer and faster ``importlib.resources`` and\n ``importlib.metadata``. Just importing ``pkg_resources`` becomes slower and\n slower the more packages are installed.\n\n\n4.2.0 (2023-09-25)\n------------------\n\n- An XML document provided as a string (i.e. decoded) now correctly\n has its content encoding parsed.\n\n- Boolean attributes are now automatically configured for templates in\n non-XML mode, presuming that we're being used to generate HTML.\n\n This means that the same loading mechanism can be used for both XML-\n and HTML-based templates.\n\n\n4.1.0 (2023-08-29)\n------------------\n\n- Boolean attributes (those configured using the optional\n `boolean_attributes` parameter) now work with $-expression\n interpolation.\n\n Unlike content and regular attributes, a special check for a falsy\n value is now done for boolean attributes, such that boolean logic\n can be used for interpolation expressions (only a truthy value will\n include the attribute).\n\n This reverts a change in behavior introduced in 3.8.0.\n\n Additionally, dynamic attributes now respect the boolean attributes\n configuration as well.\n\n4.0.1 (2023-06-19)\n------------------\n\n- Fix format spec applying for f-strings.\n (`#376 <https://github.com/malthe/chameleon/issues/376>`_)\n\n4.0.0 (2023-03-06)\n------------------\n\n- Drop support for Python 2.7, 3.5, 3.6.\n\n- Add support for set- and dict comprehensions\n (`#367 <https://github.com/malthe/chameleon/issues/367>`_)\n\n- Remove the following functions resp. modules:\n\n + ``.utils.text_()``\n + ``.utils.unescape()``\n + ``.compat``\n\n\n3.10.2 (2022-12-16)\n-------------------\n\n- Fix handling of eager compilation with subclassing (e.g. Pyramid integration).\n\n3.10.1 (2022-05-17)\n-------------------\n\n- Fix __str__ method of chameleon.exc.TemplateError\n (`#356 <https://github.com/malthe/chameleon/issues/356>`_)\n\n3.10.0 (2022-04-06)\n-------------------\n\n- Make scope class dict-like\n (`#305 <https://github.com/malthe/chameleon/issues/305>`_)\n\n- Work in FIPS enabled environments\n (`#345 <https://github.com/malthe/chameleon/issues/345>`_)\n\n- Fix tab handling issue\n (`#350 <https://github.com/malthe/chameleon/issues/350>`_)\n\n3.9.1 (2021-05-14)\n------------------\n\n- Avoid various traceback reference cycles.\n\n3.9.0 (2021-02-26)\n------------------\n\n- Removed compatibility code for unsupported Python versions\n\n- Dropped support for obsolete Python 3.4\n\n- Fixed namespace handling when redefining a variable in the same ``tal:define``\n (`#237 <https://github.com/malthe/chameleon/issues/237>`_)\n\n- Fixed failure computing a template's digest if ``template.filename`` is None\n (`#254 <https://github.com/malthe/chameleon/issues/254>`_)\n\n3.8.1 (2020-07-06)\n------------------\n\n- Added code optimization to reduce sequential appends of static text.\n\n- The `default` symbol in dynamic attributes is now\n symbolic. Previously, it was assigned the string value of the\n default attribute text. A similar change has been made for\n switch/case expressions.\n\n- The built-in `attrs` dictionary of static element attributes now\n correctly works with `tal:define`, etc.\n\n- Fix slice code generation compatibility issue on Python 3.9.\n\n3.8.0 (2020-06-25)\n------------------\n\n- Expose default marker as importable symbol\n `chameleon.tales.DEFAULT_MARKER`.\n\n- Removed legacy flag `literal_false`. To get a similar behavior, use\n `boolean_attributes`.\n\n3.7.4 (2020-06-17)\n------------------\n\n- Fix brown-bag release.\n\n3.7.3 (2020-06-17)\n------------------\n\n- Fix regression introduced in 3.6.2 where the default marker would\n incorrectly change its value between templates, causing issues in\n software which depends on the value being treated as a global\n object.\n\n3.7.2 (2020-05-31)\n------------------\n\n- Allow setting a custom value representation function, allowing\n custom formatting of variables during exception formatting.\n\n3.7.1 (2020-05-10)\n------------------\n\n- Fix compatibility issue with Python 3.9.\n\n\n3.7.0 (2020-03-26)\n------------------\n\n- Fixed garbage collection issue with variable scope objects (issue #301).\n\n- Fixed issue where setting a global variable would not be available\n locally.\n\n- A `RepeatDict` no longer inherits from `dict` since it does not\n actually provide that interface in a meaningful way.\n\n- Added feature gate `enable_comment_interpolation` which controls\n whether expression interpolation is enabled inside HTML comments\n (default is enabled).\n\n- Added support for Python 3.6+ f-strings (issue #294).\n\n3.6.2 (2019-06-22)\n------------------\n\n- Fix SyntaxWarnings in Python 3.8 resulting from comparing literals with 'is'.\n See https://github.com/plone/Products.CMFPlone/issues/2890.\n\n3.6.1 (2019-04-01)\n------------------\n\n- Fix limited search expression for illegal double hyphens in HTML\n comments to fix issue #289.\n\n3.6 (2019-02-19)\n----------------\n\n- Exclude `RuntimeError` (or `RecursionError` when available) from\n exception wrapping.\n\n- Fix double dollar '$$' escaping such that a double dollar is always\n resolved, either as an interpolation expression, or as an escape\n where it is substituted by a single dollar symbol. This is now\n consistent with Zope's handling of this character.\n\n Backslash-escaping of dollar-based string interpolation is no longer\n supported. The documentation has been updated to reflect this\n change.\n\n This fixes issue #283. Note that this reverses some of the changes\n introduced to fix issue #265.\n\n- Drop support for Python 3.3.\n\n3.5 (2018-10-17)\n----------------\n\n- Add support for Python 3.8.\n\n- Add support for TAL attributes in an XML declaration tag. This fixes\n issue #269.\n\n- Add support for custom exception handling for the `tal:on-error`\n statement. There is now an option `on_error_handler` available\n as a template configuration (issue #266).\n\n- Fix issue where double '$$' escaping would affect non-interpolation\n expressions such as the bare '$$' (issue #265).\n\n- Fix an issue where backslash dollar escaping would leave the\n backslash character still in place.\n\n3.4 (2018-07-14)\n----------------\n\nBugfixes:\n\n- Fix regression with translations in case of multiple nodes.\n\n\n3.3 (2018-05-23)\n----------------\n\nBugfixes:\n\n- Reset error token when rendering internal macro calls.\n\n- Fix edge case in exception handler causing recursion.\n [MatthewWilkes]\n\n\n3.2 (2017-10-06)\n----------------\n\nFeatures:\n\n- Add the automatic variable ``macroname`` that's bound to the name of\n the executing macro. Fixes https://github.com/malthe/chameleon/issues/238\n\n- A tokenizer can now be configured on the template class. This is\n useful in the case where the template file input is modified before\n parsing (for example, where some tags are stripped away) such that\n token positions need to be offset accordingly for error locations to\n be rendered correctly.\n\n- Expression errors now display source marker (previously only\n filename, line and column was shown).\n\n- No longer require Python source files to import modules.\n [mrh1997]\n\nOptimizations:\n\n- Exception tracking now defers metadata allocation to time of error.\n\n\n3.1 (2017-02-21)\n----------------\n\nFeatures:\n\n- Add option ``restricted_namespace`` which controls whether to\n restrict namespaces to those defined and used by the page template\n language.\n [hansroh]\n\nBugs:\n\n- Fixed attribute HTML entity escaping issue where an entity such as\n ``&`` would be encoded twice.\n\nOptimizations:\n\n- Simplify exception tracking, reducing bytecode size significantly.\n\n- Avoid checking if a static string is ``None`` during expression\n interpolation.\n\n\n3.0 (2016-12-07)\n----------------\n\nBugs:\n\n- Fix issue on Python 2 where an exception was not cleared when using\n the pipe operator and was thus accessible through `sys.exc_info()`.\n\n- The \"exists\" expression no longer leaks error information.\n\n- Escape '$$' into '$' in both content and string expressions.\n\n- Fix use of macro definition inside translation block.\n\nImprovements:\n\n- Allow unquoted attribute values.\n\n- Wrap attribute error thrown when trying to use a non-macro as a\n macro as a `RenderError` to get proper error output.\n\n- Throw a parse error if '--' (double hyphen) appears in an XML\n comment.\n\n- The `i18n:target` attribute now overrides a default\n `target_language` variable and is passed to the translation\n function.\n\n- Include filename in the on-disk cache module name. Previously,\n only the SHA digest in hex representation would be used, making\n it difficult to see where the module came from. This fixes issue\n #132.\n\n- Add support for non-ascii attribute names.\n [sank]\n\nCompatibility:\n\n- Drop support for Python 2.6, 3.1, and 3.2.\n\n\n2.25 (2016-09-24)\n-----------------\n\n- Add explicit support / testing for Python 3.5.\n\n- Add ``\\r`` to negative regex matches to the chameleon parser, where ``\\n`` is used but ``\\r`` was missing.\n Fixes a case, where the tag name was parsed into ``html\\r`` instead of ``html``.\n Fixes: https://github.com/malthe/chameleon/issues/219\n\n\n2.24 (2015-10-28)\n-----------------\n\n- Fixed Python 3.5 compatibility.\n\n- Fixed brown bag release.\n\n\n2.23 (2015-10-26)\n-----------------\n\n- Added ``enable_data_attributes`` option that allows using HTML5 data\n attributes as control attributes instead or in addition to XML\n namespace attributes.\n\n\n2.22 (2015-02-06)\n-----------------\n\n- Fix brown bag release.\n\n\n2.21 (2015-02-06)\n-----------------\n\n- Added ``RenderError`` exception which indicates that an error\n occurred during the evaluation of an expression.\n\n- Clean up ``TemplateError`` exception implementation.\n\n\n2.20 (2015-01-12)\n-----------------\n\n- Pass ``search_path`` to template class when loaded using\n ``TemplateLoader`` (or one of the derived classes).\n [faassen]\n\n\n2.19 (2015-01-06)\n-----------------\n\n- Fix logging deprecation.\n\n- Fix environment-based configuration logging error.\n\n\n2.18 (2014-11-03)\n-----------------\n\n- Fix minor compilation error.\n\n\n2.17 (2014-11-03)\n-----------------\n\n- Add support for ``i18n:context``.\n [wiggy]\n\n- Add missing 'parity' repeat property.\n [voxspox]\n\n- Don't modify environment when getting variables from it.\n [fschulze]\n\n\n2.16 (2014-05-06)\n-----------------\n\n- If a repeat expression evaluates to ``None`` then it is now\n equivalent to an empty set.\n\n This changes a behavior introduced in 2.14.\n\n This fixes issue #172.\n\n- Remove fossil test dependency on deprecated ``distribute``.\n\n- Add explicit support / testing for Python 3.3 / 3.4.\n\n- Drop explicit support for Python 2.5 (out of maintenance, and no longer\n supported by ``tox`` or ``Travis-CI``).\n\n\n2.15 (2014-03-11)\n-----------------\n\n- Add Support for Python 3.4's ``NameConstant``.\n [brakhane]\n\n\n2.14 (2013-11-28)\n-----------------\n\n- Element repetition using the ``TAL`` namespace no longer includes\n whitespace. This fixes issue #110.\n\n- Use absolute import for ``chameleon.interfaces`` module. This fixes\n issue #161.\n\n\n2.13-1 (2013-10-24)\n-------------------\n\n- Fixing brown bag release.\n\n2.13 (2013-10-21)\n-----------------\n\nBugfixes:\n\n- The template cache mechanism now includes additional configuration\n settings as part of the cache key such as ``strict`` and\n ``trim_attribute_space``.\n [ossmkitty]\n\n- Fix cache issue where sometimes cached templates would not load\n correctly.\n [ossmkitty]\n\n- In debug-mode, correctly remove temporary files when the module\n loader is garbage-collected (on ``__del__``).\n [graffic]\n\n- Fix error message when duplicate i18n:name directives are used in a\n translation.\n\n- Using the three-argument form of ``getattr`` on a\n ``chameleon.tal.RepeatDict`` no longer raises ``KeyError``,\n letting the default provided to ``getattr`` be used. This fixes\n attempting to adapt a ``RepeatDict`` to a Zope interface under\n PyPy.\n\n2.12 (2013-03-26)\n-----------------\n\nChanges:\n\n- When a ``tal:case`` condition succeeds, no other case now will.\n\nBugfixes:\n\n- Implicit translation now correctly extracts and normalizes complete\n sentences, instead of words.\n [witsch]\n\n- The ``default`` symbol in a ``tal:case`` condition now allows the\n element only if no other case succeeds.\n\n\n2.11 (2012-11-15)\n-----------------\n\nBugfixes:\n\n- An issue was resolved where a METAL statement was combined with a\n ``tal:on-error`` handler.\n\n- Fix minor parser issue with incorrectly formatted processing\n instructions.\n\n- Provide proper error handling for Python inline code blocks.\n\nFeatures:\n\n- The simple translation function now supports the\n ``translationstring`` interface.\n\nOptimizations:\n\n- Minor optimization which correctly detects when an element has no\n attributes.\n\n\n2.10 (2012-10-12)\n-----------------\n\nDeprecations:\n\n- The ``fast_translate`` function has been deprecated. Instead, the\n default translation function is now always a function that simply\n interpolates the mapping onto the message default or id.\n\n The motivation is that since version 2.9, the ``context`` argument\n is non-trivial: the ``econtext`` mapping is passed. This breaks an\n expectation on the Zope platform that the ``context`` parameter is\n the HTTP request. Previously, with Chameleon this parameter was\n simply not provided and so that did not cause issues as such.\n\n- The ``ast24`` module has been renamed to ``ast25``. This should help\n clear up any confusion that Chameleon 2.x might be support a Python\n interpreter less than version 2.5 (it does not).\n\nFeatures:\n\n- The ``ProxyExpr`` expression class (and hence the ``load:``\n expression type) is now a TALES-expression. In practical terms, this\n means that the expression type (which computes a string result using\n the standard ``\"${...}\"`` interpolation syntax and proxies the\n result through a function) now supports fallback using the pipe\n operator (``\"|\"``). This fixes issue #128.\n\n- An attempt to interpolate using the empty string as the expression\n (i.e. ``${}``) now does nothing: the string ``${}`` is simply output\n as is.\n\n- Added support for adding, modifying, and removing attributes using a\n dictionary expression in ``tal:attributes`` (analogous to Genshi's\n ``py:attrs`` directive)::\n\n <div tal:attributes=\"name value; attrs\" />\n\n In the example above, ``name`` is an identifier, while ``value`` and\n ``attrs`` are Python expressions. However, ``attrs`` must evaluate\n to a Python dictionary object (more concisely, the value must\n implement the dictionary API-methods ``update()`` and ``items()``).\n\nOptimizations:\n\n- In order to cut down on the size of the compiled function objects,\n some conversion and quoting statements have been put into\n functions. In one measurement, the reduction was 35%. The benchmark\n suite does *not* report of an increased render time (actually\n slightly decreased).\n\nBugfixes:\n\n- An exception is now raised if a trivial string is passed for\n ``metal:fill-slot``. This fixes issue #89.\n\n- An empty string is now never translated. Not really a bug, but it's\n been reported in as an issue (#92) because some translation\n frameworks handle this case incorrectly.\n\n- The template module loader (file cache) now correctly encodes\n generated template source code as UTF-8. This fixes issue #125.\n\n- Fixed issue where a closure might be reused unsafely in nested\n template rendering.\n\n- Fixed markup class ``__repr__`` method. This fixes issue #124.\n\n- Added missing return statement to fix printing the non-abbreviated\n filename in case of an exception.\n [tomo]\n\n2.9.2 (2012-06-06)\n------------------\n\nBugfixes:\n\n- Fixed a PyPy incompatibility.\n\n- Fixed issue #109 which caused testing failures on some platforms.\n\n2.9.1 (2012-06-01)\n------------------\n\nBugfixes:\n\n- Fixed issue #103. The ``tal:on-error`` statement now always adds an\n explicit end-tag to the element, even with a substitution content of\n nothing.\n\n- Fixed issue #113. The ``tal:on-error`` statement now works correctly\n also for dynamic attributes. That is, the fallback tag now includes\n only static attributes.\n\n- Fixed name error which prevented the benchmark from running\n correctly.\n\nCompatibility:\n\n- Fixed deprecation warning on Python 3 for zope interface implements\n declaration. This fixes issue #116.\n\n2.9.0 (2012-05-31)\n------------------\n\nFeatures:\n\n- The translation function now gets the ``econtext`` argument as the\n value for ``context``. Note that historically, this was usually an\n HTTP request which might provide language negotiation data through a\n dictionary interface.\n [alvinyue]\n\nBugfixes:\n\n- Fixed import alias issue which would lead to a syntax error in\n generated Python code. Fixes issue #114.\n\n2.8.5 (2012-05-02)\n------------------\n\nBugfixes:\n\n- Fixed minor installation issues on Python 2.5 and 3.\n [ppaez]\n\n- Ensure output is unicode even when trivial (an empty string).\n\n2.8.4 (2012-04-18)\n------------------\n\nFeatures:\n\n- In exception output, long filenames are now truncated to 60\n characters of output, preventing line wrap which makes it difficult\n to scan the exception output.\n\nBugfixes:\n\n- Include filename and location in exception output for exceptions\n raised during compilation.\n\n- If a trivial translation substitution variable is given (i.e. an\n empty string), simply ignore it. This fixes issue #106.\n\n2.8.3 (2012-04-16)\n------------------\n\nFeatures:\n\n- Log template source on debug-level before cooking.\n\n- The `target_language` argument, if given, is now available as a\n variable in templates.\n\n2.8.2 (2012-03-30)\n------------------\n\nFeatures:\n\n- Temporary caches used in debug mode are cleaned up eagerly, rather\n than waiting for process termination.\n [mitchellrj]\n\nBugfixes:\n\n- The `index`, `start` and `end` methods on the TAL repeat object are\n now callable. This fixes an incompatibility with ZPT.\n\n- The loader now correctly handles absolute paths on Windows.\n [rdale]\n\n2.8.1 (2012-03-29)\n------------------\n\nFeatures:\n\n- The exception formatter now lists errors in 'wrapping order'. This\n means that the innermost, and presumably most relevant exception is\n shown last.\n\nBugfixes:\n\n- The exception formatter now correctly recognizes nested errors and\n does not rewrap the dynamically generated exception class.\n\n- The exception formatter now correctly sets the ``__module__``\n attribute to that of the original exception class.\n\n2.8.0 (2012-02-29)\n------------------\n\nFeatures:\n\n- Added support for code blocks using the `<?python ... ?>` processing\n instruction syntax.\n\n The scope is name assignments is up until the nearest macro\n definition, or the template itself if macros are not used.\n\nBugfixes:\n\n- Fall back to the exception class' ``__new__`` method to safely\n create an exception object that is not implemented in Python.\n\n- The exception formatter now keeps track of already formatted\n exceptions, and ignores them from further output.\n\n2.7.4 (2012-02-27)\n------------------\n\n- The error handler now invokes the ``__init__`` method of\n ``BaseException`` instead of the possibly overridden method (which\n may take required arguments). This fixes issue #97.\n [j23d, malthe]\n\n2.7.3 (2012-01-16)\n------------------\n\nBugfixes:\n\n- The trim whitespace option now correctly trims actual whitespace to\n a single character, appearing either to the left or to the right of\n an element prefix or suffix string.\n\n2.7.2 (2012-01-08)\n------------------\n\nFeatures:\n\n- Added option ``trim_attribute_space`` that decides whether attribute\n whitespace is stripped (at most down to a single space). This option\n exists to provide compatibility with the reference\n implementation. Fixes issue #85.\n\nBugfixes:\n\n- Ignore unhashable builtins when generating a reverse builtin\n map to quickly look up a builtin value.\n [malthe]\n\n- Apply translation mapping even when a translation function is not\n available. This fixes issue #83.\n [malthe]\n\n- Fixed issue #80. The translation domain for a slot is defined by the\n source document, i.e. the template providing the content for a slot\n whether it be the default or provided through ``metal:fill-slot``.\n [jcbrand]\n\n- In certain circumstances, a Unicode non-breaking space character would cause\n a define clause to fail to parse.\n\n2.7.1 (2011-12-29)\n------------------\n\nFeatures:\n\n- Enable expression interpolation in CDATA.\n\n- The page template class now implements dictionary access to macros::\n\n template[name]\n\n This is a short-hand for::\n\n template.macros[name]\n\nBugfixes:\n\n- An invalid define clause would be silently ignored; we now raise a\n language error exception. This fixes issue #79.\n\n- Fixed regression where ``${...}`` interpolation expressions could\n not span multiple lines. This fixes issue #77.\n\n2.7.0 (2011-12-13)\n------------------\n\nFeatures:\n\n- The ``load:`` expression now derives from the string expression such\n that the ``${...}`` operator can be used for expression\n interpolation.\n\n- The ``load:`` expression now accepts asset specs; these are resolved\n by the ``pkg_resources.resource_filename`` function::\n\n <package_name>:<path>\n\n An example from the test suite::\n\n chameleon:tests/inputs/hello_world.pt\n\nBugfixes:\n\n- If an attribute name for translation was not a valid Python\n identifier, the compiler would generate invalid code. This has been\n fixed, and the compiler now also throws an exception if an attribute\n specification contains a comma. (Note that the only valid separator\n character is the semicolon, when specifying attributes for\n translation via the ``i18n:translate`` statement). This addresses\n issue #76.\n\n2.6.2 (2011-12-08)\n------------------\n\nBugfixes:\n\n- Fixed issue where ``tal:on-error`` would not respect\n ``tal:omit-tag`` or namespace elements which are omitted by default\n (such as ``<tal:block />``).\n\n- Fixed issue where ``macros`` attribute would not be available on\n file-based templates due to incorrect initialization.\n\n- The ``TryExcept`` and ``TryFinally`` AST nodes are not available on\n Python 3.3. These have been aliased to ``Try``. This fixes issue\n #75.\n\nFeatures:\n\n- The TAL repeat item now makes a security declaration that grants\n access to unprotected subobjects on the Zope 2 platform::\n\n __allow_access_to_unprotected_subobjects__ = True\n\n This is required for legacy compatibility and does not affect other\n environments.\n\n- The template object now has a method ``write(body)`` which\n explicitly decodes and cooks a string input.\n\n- Added configuration option ``loader_class`` which sets the class\n used to create the template loader object.\n\n The class (essentially a callable) is created at template\n construction time.\n\n2.6.1 (2011-11-30)\n------------------\n\nBugfixes:\n\n- Decode HTML entities in expression interpolation strings. This fixes\n issue #74.\n\n- Allow ``xml`` and ``xmlns`` attributes on TAL, I18N and METAL\n namespace elements. This fixes issue #73.\n\n2.6.0 (2011-11-24)\n------------------\n\nFeatures:\n\n- Added support for implicit translation:\n\n The ``implicit_i18n_translate`` option enables implicit translation\n of text. The ``implicit_i18n_attributes`` enables implicit\n translation of attributes. The latter must be a set and for an\n attribute to be implicitly translated, its lowercase string value\n must be included in the set.\n\n- Added option ``strict`` (enabled by default) which decides whether\n expressions are required to be valid at compile time. That is, if\n not set, an exception is only raised for an invalid expression at\n evaluation time.\n\n- An expression error now results in an exception only if the\n expression is attempted evaluated during a rendering.\n\n- Added a configuration option ``prepend_relative_search_path`` which\n decides whether the path relative to a file-based template is\n prepended to the load search path. The default is ``True``.\n\n- Added a configuration option ``search_path`` to the file-based\n template class, which adds additional paths to the template load\n instance bound to the ``load:`` expression. The option takes a\n string path or an iterable yielding string paths. The default value\n is the empty set.\n\nBugfixes:\n\n- Exception instances now support pickle/unpickle.\n\n- An attributes in i18n:attributes no longer needs to match an\n existing or dynamic attribute in order to appear in the\n element. This fixes issue #66.\n\n2.5.3 (2011-10-23)\n------------------\n\nBugfixes:\n\n- Fixed an issue where a nested macro slot definition would fail even\n though there existed a parent macro definition. This fixes issue\n #69.\n\n2.5.2 (2011-10-12)\n------------------\n\nBugfixes:\n\n- Fixed an issue where technically invalid input would result in a\n compiler error.\n\nFeatures:\n\n- The markup class now inherits from the unicode string type such that\n it's compatible with the string interface.\n\n2.5.1 (2011-09-29)\n------------------\n\nBugfixes:\n\n- The symbol names \"convert\", \"decode\" and \"translate\" are now no\n longer set as read-only *compiler internals*. This fixes issue #65.\n\n- Fixed an issue where a macro extension chain nested two levels (a\n template uses a macro that extends a macro) would lose the middle\n slot definitions if slots were defined nested.\n\n The compiler now throws an error if a nested slot definition is used\n outside a macro extension context.\n\n2.5.0 (2011-09-23)\n------------------\n\nFeatures:\n\n- An expression type ``structure:`` is now available which wraps the\n expression result as *structure* such that it is not escaped on\n insertion, e.g.::\n\n <div id=\"content\">\n ${structure: context.body}\n </div>\n\n This also means that the ``structure`` keyword for ``tal:content``\n and ``tal:replace`` now has an alternative spelling via the\n expression type ``structure:``.\n\n- The string-based template constructor now accepts encoded input.\n\n2.4.6 (2011-09-23)\n------------------\n\nBugfixes:\n\n- The ``tal:on-error`` statement should catch all exceptions.\n\n- Fixed issue that would prevent escaping of interpolation expression\n values appearing in text.\n\n2.4.5 (2011-09-21)\n------------------\n\nBugfixes:\n\n- The ``tal:on-error`` handler should have a ``error`` variable\n defined that has the value of the exception thrown.\n\n- The ``tal:on-error`` statement is a substitution statement and\n should support the \"text\" and \"structure\" insertion methods.\n\n2.4.4 (2011-09-15)\n------------------\n\nBugfixes:\n\n- An encoding specified in the XML document preamble is now read and\n used to decode the template input to unicode. This fixes issue #55.\n\n- Encoded expression input on Python 3 is now correctly\n decoded. Previously, the string representation output would be\n included instead of an actually decoded string.\n\n- Expression result conversion steps are now correctly included in\n error handling such that the exception output points to the\n expression location.\n\n2.4.3 (2011-09-13)\n------------------\n\nFeatures:\n\n- When an encoding is provided, pass the 'ignore' flag to avoid\n decoding issues with bad input.\n\nBugfixes:\n\n- Fixed pypy compatibility issue (introduced in previous release).\n\n2.4.2 (2011-09-13)\n------------------\n\nBugfixes:\n\n- Fixed an issue in the compiler where an internal variable (such as a\n translation default value) would be cached, resulting in variable\n scope corruption (see issue #49).\n\n2.4.1 (2011-09-08)\n------------------\n\nBugfixes:\n\n- Fixed an issue where a default value for an attribute would\n sometimes spill over into another attribute.\n\n- Fixed issue where the use of the ``default`` name in an attribute\n interpolation expression would print the attribute value. This is\n unexpected, because it's an expression, not a static text suitable\n for output. An attribute value of ``default`` now correctly drops\n the attribute.\n\n2.4.0 (2011-08-22)\n------------------\n\nFeatures:\n\n- Added an option ``boolean_attributes`` to evaluate and render a\n provided set of attributes using a boolean logic: if the attribute\n is a true value, the value will be the attribute name, otherwise the\n attribute is dropped.\n\n In the reference implementation, the following attributes are\n configured as boolean values when the template is rendered in\n HTML-mode::\n\n \"compact\", \"nowrap\", \"ismap\", \"declare\", \"noshade\",\n \"checked\", \"disabled\", \"readonly\", \"multiple\", \"selected\",\n \"noresize\", \"defer\"\n\n Note that in Chameleon, these attributes must be manually provided.\n\nBugfixes:\n\n- The carriage return character (used on Windows platforms) would\n incorrectly be included in Python comments.\n\n It is now replaced with a line break.\n\n This fixes issue #44.\n\n2.3.8 (2011-08-19)\n------------------\n\n- Fixed import error that affected Python 2.5 only.\n\n2.3.7 (2011-08-19)\n------------------\n\nFeatures:\n\n- Added an option ``literal_false`` that disables the default behavior\n of dropping an attribute for a value of ``False`` (in addition to\n ``None``). This modified behavior is the behavior exhibited in\n reference implementation.\n\nBugfixes:\n\n- Undo attribute special HTML attribute behavior (see previous\n release).\n\n This turned out not to be a compatible behavior; rather, boolean\n values should simply be coerced to a string.\n\n Meanwhile, the reference implementation does support an HTML mode in\n which the special attribute behavior is exhibited.\n\n We do not currently support this mode.\n\n2.3.6 (2011-08-18)\n------------------\n\nFeatures:\n\n- Certain HTML attribute names now have a special behavior for a\n attribute value of ``True`` (or ``default`` if no default is\n defined). For these attributes, this return value will result in the\n name being printed as the value::\n\n <input type=\"input\" tal:attributes=\"checked True\" />\n\n will be rendered as::\n\n <input type=\"input\" checked=\"checked\" />\n\n This behavior is compatible with the reference implementation.\n\n2.3.5 (2011-08-18)\n------------------\n\nFeatures:\n\n- Added support for the set operator (``{item, item, ...}``).\n\nBugfixes:\n\n- If macro is defined on the same element as a translation name, this\n no longer results in a \"translation name not allowed outside\n translation\" error. This fixes issue #43.\n\n- Attribute fallback to dictionary lookup now works on multiple items\n (e.g. ``d1.d2.d2``). This fixes issue #42.\n\n2.3.4 (2011-08-16)\n------------------\n\nFeatures:\n\n- When inserting content in either attributes or text, a value of\n ``True`` (like ``False`` and ``None``) will result in no\n action.\n\n- Use statically assigned variables for ``\"attrs\"`` and\n ``\"default\"``. This change yields a performance improvement of\n 15-20%.\n\n- The template loader class now accepts an optional argument\n ``default_extension`` which accepts a filename extension which will\n be appended to the filename if there's not already an extension.\n\nBugfixes:\n\n- The default symbol is now ``True`` for an attribute if the attribute\n default is not provided. Note that the result is that the attribute\n is dropped. This fixes issue #41.\n\n- Fixed an issue where assignment to a variable ``\"type\"`` would\n fail. This fixes issue #40.\n\n- Fixed an issue where an (unsuccessful) assignment for a repeat loop\n to a compiler internal name would not result in an error.\n\n- If the translation function returns the identical object, manually\n coerce it to string. This fixes a compatibility issue with\n translation functions which do not convert non-string objects to a\n string value, but simply return them unchanged.\n\n2.3.3 (2011-08-15)\n------------------\n\nFeatures:\n\n- The ``load:`` expression now passes the initial keyword arguments to\n its template loader (e.g. ``auto_reload`` and ``encoding``).\n\n- In the exception output, string variable values are now limited to a\n limited output of characters, single line only.\n\nBugfixes:\n\n- Fixed horizontal alignment of exception location info\n (i.e. 'String:', 'Filename:' and 'Location:') such that they match\n the template exception formatter.\n\n2.3.2 (2011-08-11)\n------------------\n\nBugfixes:\n\n- Fixed issue where i18n:domain would not be inherited through macros\n and slots. This fixes issue #37.\n\n2.3.1 (2011-08-11)\n------------------\n\nFeatures:\n\n- The ``Builtin`` node type may now be used to represent any Python\n local or global name. This allows expression compilers to refer to\n e.g. ``get`` or ``getitem``, or to explicit require a builtin object\n such as one from the ``extra_builtins`` dictionary.\n\nBugfixes:\n\n- Builtins which are not explicitly disallowed may now be redefined\n and used as variables (e.g. ``nothing``).\n\n- Fixed compiler issue with circular node annotation loop.\n\n2.3 (2011-08-10)\n----------------\n\nFeatures:\n\n- Added support for the following syntax to disable inline evaluation\n in a comment:\n\n <!--? comment appears verbatim (no ${...} evaluation) -->\n\n Note that the initial question mark character (?) will be omitted\n from output.\n\n- The parser now accepts '<' and '>' in attributes. Note that this is\n invalid markup. Previously, the '<' would not be accepted as a valid\n attribute value, but this would result in an 'unexpected end tag'\n error elsewhere. This fixes issue #38.\n\n- The expression compiler now provides methods ``assign_text`` and\n ``assign_value`` such that a template engine might configure this\n value conversion to support e.g. encoded strings.\n\n Note that currently, the only client for the ``assign_text`` method\n is the string expression type.\n\n- Enable template loader for string-based template classes. Note that\n the ``filename`` keyword argument may be provided on initialization\n to identify the template source by filename. This fixes issue #36.\n\n- Added ``extra_builtins`` option to the page template class. These\n builtins are added to the default builtins dictionary at cook time\n and may be provided at initialization using the ``extra_builtins``\n keyword argument.\n\nBugfixes:\n\n- If a translation domain is set for a fill slot, use this setting\n instead of the macro template domain.\n\n- The Python expression compiler now correctly decodes HTML entities\n ``'gt'`` and ``'lt'``. This fixes issue #32.\n\n- The string expression compiler now correctly handles encoded text\n (when support for encoded strings is enabled). This fixes issue #35.\n\n- Fixed an issue where setting the ``filename`` attribute on a\n file-based template would not automatically cause an invalidation.\n\n- Exceptions raised by Chameleon can now be copied via\n ``copy.copy``. This fixes issue #36.\n [leorochael]\n\n- If copying the exception fails in the exception handler, simply\n re-raise the original exception and log a warning.\n\n2.2 (2011-07-28)\n----------------\n\nFeatures:\n\n- Added new expression type ``load:`` that allows loading a\n template. Both relative and absolute paths are supported. If the\n path given is relative, then it will be resolved with respect to the\n directory of the template.\n\n- Added support for dynamic evaluation of expressions.\n\n Note that this is to support legacy applications. It is not\n currently wired into the provided template classes.\n\n- Template classes now have a ``builtins`` attribute which may be used\n to define built-in variables always available in the template\n variable scope.\n\nIncompatibilities:\n\n- The file-based template class no longer accepts a parameter\n ``loader``. This parameter would be used to load a template from a\n relative path, using a ``find(filename)`` method. This was however,\n undocumented, and probably not very useful since we have the\n ``TemplateLoader`` mechanism already.\n\n- The compiled template module now contains an ``initialize`` function\n which takes values that map to the template builtins. The return\n value of this function is a dictionary that contains the render\n functions.\n\nBugfixes:\n\n- The file-based template class no longer verifies the existence of a\n template file (using ``os.lstat``). This now happens implicitly if\n eager parsing is enabled, or otherwise when first needed (e.g. at\n render time).\n\n This is classified as a bug fix because the previous behavior was\n probably not what you'd expect, especially if an application\n initializes a lot of templates without needing to render them\n immediately.\n\n2.1.1 (2011-07-28)\n------------------\n\nFeatures:\n\n- Improved exception display. The expression string is now shown in\n the context of the original source (if available) with a marker\n string indicating the location of the expression in the template\n source.\n\nBugfixes:\n\n- The ``structure`` insertion mode now correctly decodes entities for\n any expression type (including ``string:``). This fixes issue #30.\n\n- Don't show internal variables in the exception formatter variable\n listing.\n\n2.1 (2011-07-25)\n----------------\n\nFeatures:\n\n- Expression interpolation (using the ``${...}`` operator and\n previously also ``$identifier``) now requires braces everywhere\n except inside the ``string:`` expression type.\n\n This change is motivated by a number of legacy templates in which\n the interpolation format without braces ``$identifier`` appears as\n text.\n\n2.0.2 (2011-07-25)\n------------------\n\nBugfixes:\n\n- Don't use dynamic variable scope for lambda-scoped variables (#27).\n\n- Avoid duplication of exception class and message in traceback.\n\n- Fixed issue where a ``metal:fill-slot`` would be ignored if a macro\n was set to be used on the same element (#16).\n\n2.0.1 (2011-07-23)\n------------------\n\nBugfixes:\n\n- Fixed issue where global variable definition from macro slots would\n fail (they would instead be local). This also affects error\n reporting from inside slots because this would be recorded\n internally as a global.\n\n- Fixed issue with template cache digest (used for filenames); modules\n are now invalidated whenever any changes are made to the\n distribution set available (packages on ``sys.path``).\n\n- Fixed exception handler to better let exceptions propagate through\n the renderer.\n\n- The disk-based module compiler now mangles template source filenames\n such that the output Python module is valid and at root level (dots\n and hyphens are replaced by an underscore). This fixes issue #17.\n\n- Fixed translations (i18n) on Python 2.5.\n\n2.0 (2011-07-14)\n----------------\n\n- Point release.\n\n2.0-rc14 (2011-07-13)\n---------------------\n\nBugfixes:\n\n- The tab character (``\\t``) is now parsed correctly when used inside\n tags.\n\nFeatures:\n\n- The ``RepeatDict`` class now works as a proxy behind a separate\n dictionary instance.\n\n- Added template constructor option ``keep_body`` which is a flag\n (also available as a class attribute) that controls whether to save\n the template body input in the ``body`` attribute.\n\n This is disabled by default, unless debug-mode is enabled.\n\n- The page template loader class now accepts an optional ``formats``\n argument which can be used to select an alternative template class.\n\n2.0-rc13 (2011-07-07)\n---------------------\n\nBugfixes:\n\n- The backslash character (followed by optional whitespace and a line\n break) was not correctly interpreted as a continuation for Python\n expressions.\n\nFeatures:\n\n- The Python expression implementation is now more flexible for\n external subclassing via a new ``parse`` method.\n\n2.0-rc12 (2011-07-04)\n---------------------\n\nBugfixes:\n\n- Initial keyword arguments passed to a template now no longer \"leak\"\n into the template variable space after a macro call.\n\n- An unexpected end tag is now an unrecoverable error.\n\nFeatures:\n\n- Improve exception output.\n\n2.0-rc11 (2011-05-26)\n---------------------\n\nBugfixes:\n\n- Fixed issue where variable names that begin with an underscore were\n seemingly allowed, but their use resulted in a compiler error.\n\nFeatures:\n\n- Template variable names are now allowed to be prefixed with a single\n underscore, but not two or more (reserved for internal use).\n\n Examples of valid names::\n\n item\n ITEM\n _item\n camelCase\n underscore_delimited\n help\n\n- Added support for Genshi's comment \"drop\" syntax::\n\n <!--! This comment will be dropped -->\n\n Note the additional exclamation (!) character.\n\n This fixes addresses issue #10.\n\n2.0-rc10 (2011-05-24)\n---------------------\n\nBugfixes:\n\n- The ``tal:attributes`` statement now correctly operates\n case-insensitive. The attribute name given in the statement will\n replace an existing attribute with the same name, without respect to\n case.\n\nFeatures:\n\n- Added ``meta:interpolation`` statement to control expression\n interpolation setting.\n\n Strings that disable the setting: ``\"off\"`` and ``\"false\"``.\n Strings that enable the setting: ``\"on\"`` and ``\"true\"``.\n\n- Expression interpolation now works inside XML comments.\n\n2.0-rc9 (2011-05-05)\n--------------------\n\nFeatures:\n\n- Better debugging support for string decode and conversion. If a\n naive join fails, each element in the output will now be attempted\n coerced to unicode to try and trigger the failure near to the bad\n string.\n\n2.0-rc8 (2011-04-11)\n--------------------\n\nBugfixes:\n\n- If a macro defines two slots with the same name, a caller will now\n fill both with a single usage.\n\n- If a valid of ``None`` is provided as the translation function\n argument, we now fall back to the class default.\n\n2.0-rc7 (2011-03-29)\n--------------------\n\nBugfixes:\n\n- Fixed issue with Python 2.5 compatibility AST. This affected at\n least PyPy 1.4.\n\nFeatures:\n\n- The ``auto_reload`` setting now defaults to the class value; the\n base template class gives a default value of\n ``chameleon.config.AUTO_RELOAD``. This change allows a subclass to\n provide a custom default value (such as an application-specific\n debug mode setting).\n\n\n2.0-rc6 (2011-03-19)\n--------------------\n\nFeatures:\n\n- Added support for ``target_language`` keyword argument to render\n method. If provided, the argument will be curried onto the\n translation function.\n\nBugfixes:\n\n- The HTML entities 'lt', 'gt' and 'quot' appearing inside content\n subtition expressions are now translated into their native character\n values. This fixes an issue where you could not dynamically create\n elements using the ``structure`` (which is possible in ZPT). The\n need to create such structure stems from the lack of an expression\n interpolation operator in ZPT.\n\n- Fixed duplicate file pointer issue with test suite (affected Windows\n platforms only). This fixes issue #9.\n [oliora]\n\n- Use already open file using ``os.fdopen`` when trying to write out\n the module source. This fixes LP #731803.\n\n\n2.0-rc5 (2011-03-07)\n--------------------\n\nBugfixes:\n\n- Fixed a number of issues concerning the escaping of attribute\n values:\n\n 1) Static attribute values are now included as they appear in the\n source.\n\n This means that invalid attribute values such as ``\"true &&\n false\"`` are now left alone. It's not the job of the template\n engine to correct such markup, at least not in the default mode\n of operation.\n\n 2) The string expression compiler no longer unescapes\n values. Instead, this is left to each expression\n compiler. Currently only the Python expression compiler unescapes\n its input.\n\n 3) The dynamic escape code sequence now correctly only replaces\n ampersands that are part of an HTML escape format.\n\nImports:\n\n- The page template classes and the loader class can now be imported\n directly from the ``chameleon`` module.\n\nFeatures:\n\n- If a custom template loader is not provided, relative paths are now\n resolved using ``os.abspath`` (i.e. to the current working\n directory).\n\n- Absolute paths are normalized using ``os.path.normpath`` and\n ``os.path.expanduser``. This ensures that all paths are kept in\n their \"canonical\" form.\n\n\n2.0-rc4 (2011-03-03)\n--------------------\n\nBugfixes:\n\n- Fixed an issue where the output of an end-to-end string expression\n would raise an exception if the expression evaluated to ``None`` (it\n should simply output nothing).\n\n- The ``convert`` function (which is configurable on the template\n class level) now defaults to the ``translate`` function (at\n run-time).\n\n This fixes an issue where message objects were not translated (and\n thus converted to a string) using the a provided ``translate``\n function.\n\n- Fixed string interpolation issue where an expression immediately\n succeeded by a right curly bracket would not parse.\n\n This fixes issue #5.\n\n- Fixed error where ``tal:condition`` would be evaluated after\n ``tal:repeat``.\n\nFeatures:\n\n- Python expression is now a TALES expression. That means that the\n pipe operator can be used to chain two or more expressions in a\n try-except sequence.\n\n This behavior was ported from the 1.x series. Note that while it's\n still possible to use the pipe character (\"|\") in an expression, it\n must now be escaped.\n\n- The template cache can now be shared by multiple processes.\n\n\n2.0-rc3 (2011-03-02)\n--------------------\n\nBugfixes:\n\n- Fixed ``atexit`` handler.\n\n This fixes issue #3.\n\n- If a cache directory is specified, it will now be used even when not\n in debug mode.\n\n- Allow \"comment\" attribute in the TAL namespace.\n\n This fixes an issue in the sense that the reference engine allows\n any attribute within the TAL namespace. However, only \"comment\" is\n in common use.\n\n- The template constructor now accepts a flag ``debug`` which puts the\n template *instance* into debug-mode regardless of the global\n setting.\n\n This fixes issue #1.\n\nFeatures:\n\n- Added exception handler for exceptions raised while evaluating an\n expression.\n\n This handler raises (or attempts to) a new exception of the type\n ``RenderError``, with an additional base class of the original\n exception class. The string value of the exception is a formatted\n error message which includes the expression that caused the\n exception.\n\n If we are unable to create the exception class, the original\n exception is re-raised.\n\n2.0-rc2 (2011-02-28)\n--------------------\n\n- Fixed upload issue.\n\n2.0-rc1 (2011-02-28)\n--------------------\n\n- Initial public release. See documentation for what's new in this\n series.\n\n\n",
"bugtrack_url": null,
"license": "BSD-like (http://repoze.org/license.html)",
"summary": "Fast HTML/XML Template Compiler.",
"version": "4.5.4",
"project_urls": {
"Documentation": "https://chameleon.readthedocs.io",
"Homepage": "https://chameleon.readthedocs.io",
"Issue Tracker": "https://github.com/malthe/chameleon/issues",
"Sources": "https://github.com/malthe/chameleon"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c39381bdaab379a5908876a1029e73fa85e2d90fe04cbc1c2200b3179bc19a75",
"md5": "f38293956f92cc9bde409f4d2e638eb8",
"sha256": "efca0e1c796ec8f0fa011d90940d48a8f935e23757d6fa95c1c032f235a73f13"
},
"downloads": -1,
"filename": "Chameleon-4.5.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f38293956f92cc9bde409f4d2e638eb8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 88207,
"upload_time": "2024-04-08T07:16:59",
"upload_time_iso_8601": "2024-04-08T07:16:59.054967Z",
"url": "https://files.pythonhosted.org/packages/c3/93/81bdaab379a5908876a1029e73fa85e2d90fe04cbc1c2200b3179bc19a75/Chameleon-4.5.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "00d0c686d98510ce9ed5764284c119ec16959c67ac295928673f970df0dc4d4a",
"md5": "a0051798afca92e7d9328a4b2367bbe9",
"sha256": "42f646e1208e8cdcc106182b246adf11900e89cbe4440ba334d28c4087bb02f1"
},
"downloads": -1,
"filename": "Chameleon-4.5.4.tar.gz",
"has_sig": false,
"md5_digest": "a0051798afca92e7d9328a4b2367bbe9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 180464,
"upload_time": "2024-04-08T07:16:51",
"upload_time_iso_8601": "2024-04-08T07:16:51.129240Z",
"url": "https://files.pythonhosted.org/packages/00/d0/c686d98510ce9ed5764284c119ec16959c67ac295928673f970df0dc4d4a/Chameleon-4.5.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-08 07:16:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "malthe",
"github_project": "chameleon",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "chameleon"
}