Download SimpleTAL for Python 2

This page contains version of SimpleTAL compatible with Python 2.  Newer releases are compatible with Python 3.


Version 4.3

Bug fixes

  • Included missing xml files from the Element Tree example

Version 4.2

WARNING: This version is not fully backwards compatible!  The default character encoding for XML templates is now utf-8 rather than iso8859-1.  The minimum Python version supported is 2.5.

Bug fixes

  • XML Templates now default to utf-8 for output encoding.
  • Fixed corruption of attributes on a repeat tag if use-macro was used inside it (thanks to Benjamin Niemann for the bug report).
  • Updates to for compatibility with Python 2.6.
  • Use md5 from hashlib to fix DeprecationWarning within tests.

Version 4.1

This release is mainly to address defects in the handling of HTML Entities in template attributes.

New features

  • Processing Instructions are now supported in HTML templates.

Bug fixes

  • The use of "&" in attributes was broken in 4.0 - fixed (thanks to Alain Spineux for the bug report).

Version 4.0

This version of SimpleTAL is not 100% backwards compatible with the 3.x series of releases.  Version 4.0 of SimpleTAL requires Python 2.2 or higher.

New features

  • Added support for minimizing boolean attributes in HTML (minimizeBooleanAtts = 1).
  • Switched HTML parser library from SGMLParser to HTMLParser.  HTMLParser is generally less strict than the SGMLParser, however it doesn't handle unbalanced quotes around attributes (thanks to Carlos Neves for the initial patch).
  • All METAL namespace attributes are automatically omitted, not just those in XML templates.

Version 3.13

This release adds support for compiling templates from DOM trees and using Iterators for tal:repeat loops.

New features

  • Added support for compiling a template from a DOM tree (thanks to Benjamin Niemann for the patch).
  • Added support for iterators in the Context (thanks to Kevin Smith for the ideas).

Bug fixes

  • ElementTree paths can now be used from 'python: path ()' expressions (thanks to Jochen Kupperschmidt for the fix).

Version 3.12

This release includes optional support for ElementTree, allowing XML documents to be placed directly into the SimpleTAL Context and accessed from TAL.  For more details refer to the documentation, the example included in the download and a weblog post I made on the subject.

New features

  • Integration with ElementTree.
  • Use Python 2.2's unicode function if available (honours the __unicode__ method) when converting non-unicode variables in the Context.

Bug fixes

  • Allow sub-classes of string and Unicode strings to be placed in the Context.

Version 3.11

This release changes how HTML templates containing entity references and character references are handled.  In previous releases any references contained in the HTML would be passed through to the output intact.  In order to solve the double escaping bug described below all character references are now expanded in the output with the exception of <, > and &

Bug fixes

  • If multiple variable substitutions are used in a single 'string:' path and one failed the whole path would evaluate to an empty string.
  • When <input name="name"> was used <input name=""> was output.
  • The global variable 'attrs' should be a dictionary, not a list (Thanks to Christoph Zwerschke for the bug report).
  • Content accessed through attrs would be double escaped.

Version 3.10

New features

  • Included API documentation and TAL reference guide with archive.

Bug fixes

  • Attributes on repeat tags were not correctly kept for nested repeats.  (Thanks to Aadish Shrestha for the bug report)

Version 3.9

This is release is focused on improving performance.  Compared to version 3.8 the performance of expanding templates is ~45-70% faster.  The performance of parsing templates is unchanged.

WARNING: IF you rely on the internal workings of SimpleTALES in your application then there will be changes that are required to make use of this version of SimpleTAL.  The API for SimpleTAL is however unchanged.

New features

  • Introduced simpleTALUtils.FastStringOutput which can be used to capture the output of SimpleTAL in a faster manner than StringIO.
  • Introduced simpleTALES.CachedFuncResult which can be used to wrap functions in the Context, and which cache's the result of the function call to ensure that the function is only called once during template expansion.
  • TALES no longer wraps all results in ContextVariable instances when returning values to TAL.
  • Changed copy.copy to {}.copy for performance improvement.
  • Removed logging.debug() calls from performance critical paths.
  • Replaced DefaultVariable class with simpleTALES.DEFAULTVALUE
  • Replaced NothingVariable class with None
  • Removed NoCallVariable
  • Removed isDefault, isNothing, isSequence, isCallable, and isTrue from ContextVariable.


Version 3.8

New features

  • Added new method getXMLTemplate to simpleTALUtils.TemplateCache.
  • Comments in XML templates are now included in the output if pyxml is installed.
  • Lists can now be indexed into.

Bug fixes

  • TAL commands on METAL namespaced elements and vice-versa now work correctly (thanks to Kevin Smith for the bug report).

Version 3.7

New features

  • When non-ascii, non-Unicode strings are present in the Context a Unicode error is thrown.  Now an ERROR log message indicates that this is the most likely cause of the problem.

Bug fixes

  • Correction to cgi-example (thanks to Frank Wierzbicki for the patch).
  • Local defines that reference earlier local defines on one tag now work.
  • Using default values in a repeat list now work as expected.
  • Errors during codec conversions will now use 'replace' rather than 'strict'

Version 3.6

New features

  • The XML Declaration can now be suppressed by passing suppressXMLDeclaration=1 to the template "expand" method.

Bug fixes

  • Removed stray 'info' logging call.

Version 3.5

This release includes several fixes around the handling of special characters in XML and HTML attribute values.

New features

  • The 'test' function is now available to code used in 'python:' paths.  Usage is the same as zope: test (test1,val1[,test2,val2][,default]).  (Thanks to Mark McEahern for the feature request)
  • Uses PyXML ( to determine the DOCTYPE of XML templates (if installed).  (Thanks to Myers Carpenter for the implementation)

Bug fixes

  • CGI Example fixes.
  • XML Templates containing attributes with character entities are now output correctly.
  • HTML Templates with special characters as part of TAL or METAL commands are now handled correctly.
  • The default encoding is now iso-8859-1 rather than iso8859-1.

Version 3.4

This release brings many fixes to the handling of XHTML.  Many thanks to all those that helped by reporting bugs, making suggestions, and providing patches.

New features

  • TemplateCache now uses MTIME rather than CTIME to spot changes to templates.
  • SimpleTAL is now compatible with PyXML 0.8.2 (Thanks to Myers Carpenter for the testing).
  • Added support for passing in an XML Doctype when calling template.expand
  • Added support to maintain XML singleton tags, including use of METAL and TAL on singleton tags.
  • Added support for using variables in paths (e.g. If colour='blue' then the path 'colourMap/?colour' is equivalent to 'colourMap/blue').  This is not part of the TALES specification, but is supported by Zope.  (Thanks to Bastian Kleineidam for the initial implementation).

Bug fixes

  • If the logging module was not installed exceptions would be thrown when SimpleTAL attempted to log errors - fixed.

Version 3.3

New features

I've introduced a formal BSD style license for SimpleTAL in this release.

  • TemplateCache now supports inputEncoding, allowing HTML templates using character sets other than ISO8859-1 to be used.
  • Functions path, string, exists, and nocall are available to python: paths.
  • Functions can now receive parameters via paths by wrapping them in simpleTALES.PathFunctionVariable before placing them into the Context.

Bug fixes

  • In tal:attributes and tal:define double escaped semi-colons are now handled.
  • Space after a semi-colon in tal:attributes and tal:define is now handled (thanks to Sean Reifschneider)
  • Handling of stray quotes at the start and end of attributes shouldn't interfere with python: paths anymore.

Version 3.2

This release incorporates patches from Wichert Akkerman implementing the Python TAL path and moving to string methods instead of using the string module.

New features

  • The 'python:' path can now be used, pass the parameter 'allowPythonPath=1' to the constructor of SimpleTALES.Context to enable.
  • simpleTALUtils now contains a template caching class (TemplateCache) that can be used to cache compiled templates, automatically invalidating the cache if the template file has changed.
  • The string module is no longer used, replaced by string methods.

Bug fixes

  • Nested repeat variables with the same name are now scoped correctly.
  • If logging is available all error messages are now suppressed during testing.

Version 3.1

With this release import statements need to be changed.  Please now use: from simpletal import simpleTAL, simpleTALES  The API has not changed.

New Features

  • SimpleTAL can now be installed using distutils, thanks to Michael Twomey.

Bug fixes

  • If tal:repeat and tal:content were used on the same element, the last piece of content would be present twice - fixed.
  • If a path element inside a string: path evaluated to something other than a string or unicode string, it would not be evaluated.  Now an attempt to coerce the value to a string is done using the str function.

Version 3.0

New features

  • METAL Support added
  • The TAL and METAL name-spaces can now be bound to any prefix
  • When using XML Templates any elements in the TAL or METAL name-space have their start and end tags suppressed.


Version 2.3

Bug fixes

  • Using tal:repeat on empty lists would cause an exception to be thrown.

Version 2.2

Version 2.1 did not output HTML document type declarations, even when present in the HTML template.  This release address this, and other correctness issues.

Bug fixes

  • HTML Document type declarations were not being passed through from the template.
  • HTML Comments are now passed through to the output.
  • End tags with no start tag now raise an error rather than failing silently.
  • The first text element in a template is now combined with other text elements.
  • XML Processing Instructions are now passed through the template correctly.

Version 2.1

Bug fix that allows HTML templates to be valid HTML, and expanded templates to produce valid HTML.  See notes for more details on the consequences of this change.

New features

  • A simplification of how local variables are handled brings a 5-10% performance gain

Bug fixes

  • HTML Templates will now suppress the output of close tags for elements that are forbidden to have them in HTML 4.01.  Additionally tags that can have no close tag in HTML can still have TAL attributes.  This means that HTML templates can still be valid HTML, and produce valid HTML.  For example:  '<html><img tal:attributes="src imgSrc"></html>' is now valid, and will only output the <img> tag.

Version 2.0

Complete refactoring of simpleTAL leading to very significant performance improvements. 

New features

  • Large performance improvements by splitting the process into two.
  • Templates once compiled can now be reused, leading to large performance gains.

Bug fixes

  • Any unknown entity references present in a HTML template were not passed through to the rendered template, now they are.
  • Attributes created using tal:attributes did not have their values escaped properly.

Version 1.1

New features

  • Added test cases for TALES and TAL (both HTML and XML).
  • Added allowTALInStructure flag to control expansion of TAL attributes.

Bug fixes

  • The "structure" keyword when used in XML templates would fail with an exception.

Version 1.0

Initial release.

Last Modified: Sun, 01 Feb 2015 10:59:33 CET

Made with PubTal 3.5

Copyright 2021 Colin Stewart

Email: colin at