Chameleon Changelog

What's new in Chameleon 2.22

Feb 10, 2015
  • Fix brown bag release.

New in Chameleon 2.21 (Feb 10, 2015)

  • Added RenderError exception which indicates that an error occurred during the evaluation of an expression.
  • Clean up TemplateError exception implementation.

New in Chameleon 2.20 (Feb 3, 2015)

  • Pass search_path to template class when loaded using TemplateLoader (or one of the derived classes). [faassen]

New in Chameleon 2.19 (Feb 3, 2015)

  • Fix logging deprecation.
  • Fix environment-based configuration logging error.

New in Chameleon 2.18 (Nov 24, 2014)

  • Fix minor compilation error.

New in Chameleon 2.17 (Nov 24, 2014)

  • Add support for i18n:context.
  • Add missing 'parity' repeat property.
  • Don't modify environment when getting variables from it.

New in Chameleon 2.16 (Jun 27, 2014)

  • 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).

New in Chameleon 2.15 (Mar 25, 2014)

  • Add Support for Python 3.4's NameConstant.

New in Chameleon 2.13-1 (Oct 25, 2013)

  • Fixing brown bag release.

New in Chameleon 2.13 (Oct 22, 2013)

  • The template cache mechanism now includes additional configuration settings as part of the cache key such as ``strict`` and ``trim_attribute_space``.
  • Fix cache issue where sometimes cached templates would not load correctly.
  • In debug-mode, correctly remove temporary files when the module loader is garbage-collected (on ``__del__``).
  • 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.

New in Chameleon 2.12 (Sep 28, 2013)

  • 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.

New in Chameleon 2.10 (Oct 12, 2012)

  • 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)
  • 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).
  • Bug fixes:
  • 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]

New in Chameleon 2.9.2 (Jun 6, 2012)

  • Bugfixes:
  • Fixed a PyPy incompatibility.
  • Fixed issue #109 which caused testing failures on some platforms.

New in Chameleon 2.8.4 (Apr 18, 2012)

  • 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.
  • Bug fixes:
  • 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.

New in Chameleon 2.8.1 (Mar 29, 2012)

  • Features:
  • The exception formatter now lists errors in 'wrapping order'. This means that the innermost, and presumably most relevant exception is shown last.
  • Bug fixes:
  • 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.

New in Chameleon 2.8.0 (Feb 29, 2012)

  • Features:
  • Added support for code blocks using the processing instruction syntax.
  • The scope is name assignments is up until the nearest macro definition, or the template itself if macros are not used.
  • Bug fixes:
  • 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.

New in Chameleon 2.7.4 (Feb 27, 2012)

  • The error handler now invokes the __init__ method of BaseException instead of the possibly overriden method (which may take required arguments). This fixes issue #97. [j23d, malthe]

New in Chameleon 2.7.3 (Jan 16, 2012)

  • Bug fixes:
  • 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.

New in Chameleon 2.7.2 (Jan 9, 2012)

  • 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.
  • Bug fixes:
  • 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.

New in Chameleon 2.7.1 (Dec 30, 2011)

  • Features:
  • Enable expression interpolation in CDATA.
  • The page template class now implements dictionary access to macros.
  • Bug fixes:
  • 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.

New in Chameleon 2.7.0 (Dec 13, 2011)

  • 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.
  • Bug fixes:
  • 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.

New in Chameleon 2.5.2 (Oct 12, 2011)

  • 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.

New in Chameleon 2.4.6 (Sep 23, 2011)

  • Bug fixes:
  • The tal:on-error statement should catch all exceptions.
  • Fixed issue that would prevent escaping of interpolation expression values appearing in text.

New in Chameleon 2.4.3 (Sep 13, 2011)

  • Features:
  • When an encoding is provided, pass the 'ignore' flag to avoid decoding issues with bad input.
  • Bug fixes:
  • Fixed pypy compatibility issue (introduced in previous release).

New in Chameleon 2.4.1 (Sep 8, 2011)

  • Bug fixes:
  • 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.

New in Chameleon 2.4.0 (Aug 23, 2011)

  • 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.
  • 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.

New in Chameleon 2.3.8 (Aug 19, 2011)

  • Fixed import error that affected Python 2.5 only.

New in Chameleon 2.3.8 (Aug 19, 2011)

  • Fixed import error that affected Python 2.5 only.

New in Chameleon 2.3.6 (Aug 18, 2011)

  • 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 will be rendered as . This behavior is compatible with the reference implementation.

New in Chameleon 2.3.2 (Aug 11, 2011)

  • Bugfixes:
  • Fixed issue where i18n:domain would not be inherited through macros and slots. This fixes issue #37.

New in Chameleon 2.2 (Jul 29, 2011)

  • 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 existance 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.

New in Chameleon 2.1.1 (Jul 28, 2011)

  • 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.

New in Chameleon 2.1 (Jul 26, 2011)

  • 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.

New in Chameleon 2.0 RC 12 (Jul 5, 2011)

  • 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.

New in Chameleon 2.0 RC10 (May 24, 2011)

  • 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.

New in Chameleon 2.0 RC7 (Mar 29, 2011)

  • 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).

New in Chameleon 1.2.13 (Sep 23, 2010)

  • Fixed issue where a repeat variable's entry in the repeat symbol would not get carried over with a macro slot (LP #644712; reported by Joshua LaPlace).
  • Added support for attrs (read-only dictionary which contains static attributes).
  • Fixed issue where the temporary template cache which is set up to aid debugging would not get purged automatically.

New in Chameleon 1.2.12 (Sep 9, 2010)

  • Parser is now able to parse documents which contain non-structured fragments.
  • Compiler now reports an error if an expression type is unknown.
  • Edge-case issue where an expression result was actually not a dynamic value, but a static string (e.g. string: Hello).

New in Chameleon 1.2.11 (Sep 7, 2010)

  • Avoid escaping already computed content from named regions inside a translation block.
  • Always generate dynamic message ids dynamically when unnamed elements are present.
  • Fixed an issue where the presence of an unnamed elements inside an anonymous translation block would result in an error when translation failed.
  • Put a lock around compilation. This should guarantee stability (some reports suggest that there's code in the compilation loop which is not thread-safe) without a drop in performance (GIL is there, in spite all).

New in Chameleon 1.2.7 (Jul 8, 2010)

  • Update Babel extractor for python to check source file encoding. This fixes problems with non-ASCII strings.

New in Chameleon 1.2.6 (Jun 28, 2010)

  • Resolve real path before checking the XInclude registry. This fixes cache misses when using relative paths.

New in Chameleon 1.2.3 (Apr 20, 2010)

  • Added parameter debug to template constructor to enable debug mode. The default value is taken from the CHAMELEON_DEBUG environment value and defaults to False.
  • The use of debug mode is recommended during development.
  • Improved exception output in debug-mode; for nested usage, sections now carry the correct filename.
  • Fixed an issue where an incorrect expression annotation would be shown, or none at all.
  • When in debug-mode, take steps to ensure traceback is not swallowed in properties by explicit invocation.

New in Chameleon 1.2.2 (Apr 17, 2010)

  • Fixed regression where objects that are not strings or numbers would not output due to a recent change in policy that subjected such objects to the translation machinery. However, the default translation function had a bug that instead returned None.
  • The new behavior is that such objects are coerced to unicode by default.
  • Note that if zope.i18n is available, an alternative translation function is used; this function, however, has the correct behavior already.
  • Fixed issue where nested translations would drop named blocks due to a name clash.

New in Chameleon 1.2.0 (Mar 29, 2010)

  • Fixed issue where nested translations would fail.
  • Added support for passing in a translation function to the template constructor.
  • Fixed issue where translation name mappings would conflict with template function definitions.
  • Fixed symbol lookup issue with list comprehensions and lambda expressions.
  • Fixed issue with interpolation flag and CDATA; the effect of this flag is now recursive, which indirectly means that CDATA elements will be affected by a setting on a parent tag.
  • XML namespace fixes.
  • Template instances may now be used as macros; this will use the template in its entirety, including any XML declarations. This addresses issue #139.
  • Integrated Genshi implementation.
  • Allow expression interpolation on any tag which is not part of the Chameleon or ZPT namespaces (e.g. TAL, METAL, I18N or META).
  • Improve XML parsing error handling.

New in Chameleon 1.1.2 (Feb 26, 2010)

  • Avoid printing document header strings (XML header and DOCTYPE) twice; this would previously happen if a template would define these and use a macro on the top level which also provided them.
  • The repeat variable attributes (odd, even etc.) are now callable strings, e.g. legacy users may still call these attributes, but it is no longer required.
  • The odd and even attributes now return the English strings "odd" and "even" in place of True and the empty string "" instead of False.

New in Chameleon 1.1.1 (Jan 27, 2010)

  • Python 2.5 compatibility fixes (symptom: TypeError: default __new__ takes no parameters with the statement generating the error something like ast.Name("econtext", ast.Load())).

New in Chameleon 1.0.7 (Jan 7, 2010)

  • Fixed encoding issue of translated attributes. [kobold]
  • Fixed translation issue, that would prevent translation of tag contents with both named and unnamed subtags. [kobold]
  • Fixed issue where messages could contain a double space. [kobold]