Quantcast
Channel: Planet Python
Viewing all articles
Browse latest Browse all 22906

Declassed Art: Clabate: minimalistic class-based templates for Python

$
0
0

Clabate is a minimalistic template system for Python language.

Clabate does not offer yet another mini-language for templates. It is based on class inheritance and PEP 3101 string formatting.

The basic idea is simple: declare template strings as class attributes and render them in the right order in some container called context.

Subclasses may re-define template strings and define new ones.

Dynamic content can be generated using class properties and values passed as kwargs to the constructor and/or render method.

In the very basic layer Clabate implements bare textual templates which can be used, for example, to generate configuration files.

And that basic layer is extended by MarkupTemplate, which escapes everything by default, trying to minimize chances to overlook unescaped substitutions.


Viewing all articles
Browse latest Browse all 22906

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>