Reputation: 83768
Reading https://pypi.python.org/pypi/five.pt/2.2.1
To enable Chameleon, configure the package using ZCML:
<include package="five.pt" />
Are Chameleon templates enabled per-package or globally? Instructions are little sparse.
If I want to enable Chameleon for a particular package only is it possible? (making migrating to Chameleon easier)
Upvotes: 1
Views: 227
Reputation: 1121316
To quote directly from the PyPI page for the package:
It works using monkey-patching onto the existing API (specifically, the
TALInterpreter
andPageTemplate
classes). In simple terms, what the patching does is to replace the TAL interpreter class and make sure that the so-called "cooking" routine uses the Chameleon parser and compiler instead of thezope.*
reference implementation.
So, when you load the five.pt
package, the regular page templates code is patched to use Chameleon templates instead when templates are cooked (compiled).
That really precludes enabling Chameleon and disabling Chameleon on a package-by-package basis. Once any packages uses the <include package="five.pt" />
directive, the five.pt
configure.zcml
file is loaded and the patch is applied.
That said, theoretically it should be possible to add per-package enabling or disabling back into the patch; the __call__
and cook
methods of the five.pt
Program
utility would have to be taught how to detect what package the template applies to and make a decision on what RepeatDict
class and page template object to use.
Upvotes: 1