Package: collective.templateengines
ContentsFeaturesMotivationInstallationUsageTagsProblemsExamplesLinksSource codeAuthorsChangelog0.3.5 (2013-05-07)0.3.2 - 0.3.40.3.1 - 0.3.20.3.0 - 0.3.10.1.1 - 0.3.00.1 - 0.1.10.1collective.templateengines  is an template engine abstraction layer for Python.
It defines generic Zope interfaces for communicating with various Python template engines
to achieve higher code reuse value.This package is still much in development. All contributions and comments are welcome.Featurescollective.templateengines helps you to achieveEasy, pluggable, template language switching. Write template tag code only once and use it across all template engines
using abstracted tag plug-ingsClean your codebase from template engine dependenciesGeneric error and warning reporting mechanism across template enginesEGG deployment and easy_install support from PyPi repositoryInterfaces defined using standardZope interfacespackageBackends for Django template Language, Cheetah and Jinja2Unit testsMotivationAll template engines have their shortcomings. Sooner or later you want to try yet another engine,
or someone else wants to use another template engine within your project. This package
is aimed to make that transition as smooth as possible.InstallationInstall collective.templateengines eggInstall any of following template engine eggs: Django, Jinja2, CheetahUsagePlease take a look oncollective.easytemplatepackage how to support switching
between template engines and registering tags for them.The following example shows how one can switch between Django and Cheetah template engines with one line of change.
Naturally, the templates themselves need to be refactored.Cheetah:from collective.templateengines.backends import cheetah

engine = cheetah.Engine()
context = DictionaryContext({"foo":"bar"})
template, syntax_errors = engine.loadString("Show variable $foo", False)
result, evaluation_errors = template.evaluate(context)Django:from collective.templateengines.backends import djangotemplates

engine = djangotemplates.Engine()
context = DictionaryContext({"foo":"bar"})
template, syntax_errors = engine.loadString("Show variable {{ foo }}", False)
result, evaluation_errors = template.evaluate(context)Tagscollective.templateengine uses term tag to refer to functions which you can use in the template engine context.
In the future tags are indended to be expanded to cover template language structures as well.collective.templateengines does not come with any tags out of the box. To define tags, I recommend
you to take a look on collective.easytemplate package.Tags provide collective.templateengines.interfaces.ITag interfaceTags are registered to the template engine using Engine.addTag() function.ProblemsCheetah architecture lacks separate exposed compiling and evaluating phasesCheetah exposes the full Python namespace to templates by default, making it hard to secure itCheetah cannot traverse Zope functions or attributesExamplesPython Template Engines is used inEasy Template productfor Plone.LinksJinja2 template enginesDjango templatesCheetah template engineSource codehttps://svn.plone.org/svn/collective/collective.templateengines/trunkAuthorsmFabrik Research Oy- Python and Plone professionals for hire.mFabrik web sitemFabrik mobile siteBlogMore about PloneChangelog0.3.5 (2013-05-07)first import for plone 4.3
[vangheem]0.3.2 - 0.3.4Fixed various problems when context or HTTP request was
not available or they were “special” in Plone templates [miohtama]Fixed compatibility issues with LinguaPlone [miohtama]0.3.1 - 0.3.2Fixed unicode problems with Archetypes accessorsDocumentation clean ups0.3.0 - 0.3.1Fixed problem in plone.py with problematic Archetypes schema fields0.1.1 - 0.3.0Major rework0.1 - 0.1.1Fixing PyPi deployment problems0.1Initial release