最近リリースされた Turbogears 2.1 では、genshi のようなテンプレート エンジンである kajiki のサポートについて言及されていましたが、tg2.1 を kajiki で使い始める方法に関するリソースが見つかりません。何か案は?
1 に答える
I enabled Kajiki in a TG 2.1 project by changing the <projectname>/config/app_cfg.py
file.
After the line
base_config.renderers.append('genshi')
just add
base_config.renderers.append('kajiki')
You can later use a Kajiki template from any of your actions by decorating it with something like
@expose('kajiki:projectname.templates.sometemplate')
You can also set Kajiki as the default template language by changing the base_config.default_renderer
assignment in app_cfg.py
. If you do this, you won't need the kajiki:
prefix when decorating, e.g.,
@expose('projectname.templates.sometemplate')
will suffice.
After this works for you, changing setup.py
to add a Kajiki dependency is probably all you need in order to have a working project. The only thing I haven't tried as yet is i18n; I'll probably update this answer when I do.