mike watkins dot ca : October 10 2005 Archives

October 10 2005

SimpleTemplate... Yet Another Python Template

SimpleTemplate is not a package or product of any sort, just a simple little recipe for doing string substitution in simple text templates, while still taking advantage of Quixote’s PTL: Python Template Language, the un-templating template language.

`_escape_namespace` returns a copy of the mapping supplied to format_text, automatically escaping all values supplied to the template, unless they’ve already been explicitly declared safe using Quixote’s ‘htmltext’ class, or have already been ‘htmlescaped’.

Its simple, perhaps too simple, but seems useful for injecting ‘chunks’ of text or html into placeholder-style templates.