phlaccide
phlaccide

Reputation: 1

Using kajiki in TG2.1

the recently released turbogears 2.1 mentioned about the support of kajiki, a genshi-like templating engine, but i cant find any resource on how to get started to use tg2.1 with kajiki. any ideas?

Upvotes: 0

Views: 259

Answers (1)

msoto
msoto

Reputation: 31

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.

Upvotes: 3

Related Questions