Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #214 (closed enhancement: fixed)

Opened 14 years ago

Last modified 12 years ago

Cheetah templates support

Reported by: jal@… Owned by: jal@…
Priority: normal Milestone: 0.9
Component: TurboGears Version:
Severity: normal Keywords: cheetah
Cc:

Description

This simple patch to view.py adds  cheetah template support to Turbogears. I'm more experienced with (and personally favor) cheetah over kid so I guessed patching tg would be easier for me than learning kid ;)

Templating system defaults to Kid, specify:

tg.templateType='cheetah'

In your config file to switch to cheetah.

I haven't tested it with Kid but I pretty sure I haven messed anything up (except i18n I guess). Works flawlessly for me with cheetah. Just drop your compiled templates in your template dir (makefile included) and refer to them as usual:

@turbogears.expose(html="yourproject.templates.your_cheetah_compiled_template")

I'm experimenting with caching instantiated templates and just updating it's dict with new placeholder values for each request (as to take advantage of cheetah's caching) instead of lookupTemplate returning a class object. I guess it would make the patch bigger and more complicated as I need to change the way controller.py fills the template and take into account thread syncronization issues. For now i'll just upload this small and easy patch as it works for me ;).

Patched against r314.

Nice framework, I'm diving into it. Alberto

Attachments

cheetahsupport.diff Download (3.5 KB) - added by jal@… 14 years ago.
Patch against view.py
Makefile Download (489 bytes) - added by jal@… 14 years ago.
To precompile templates

Change History

Changed 14 years ago by jal@…

Patch against view.py

Changed 14 years ago by jal@…

To precompile templates

comment:1 Changed 14 years ago by anonymous

  • Keywords cheetah added
  • Owner changed from anonymous to jal@…
  • Summary changed from Cheetah templates support to [PATCH] Cheetah templates support

comment:2 Changed 14 years ago by jal@…

This patch breaks i18n support for cheetah NOT for kid. Just wanted to make that clear.

comment:3 Changed 14 years ago by kevin

  • Summary changed from [PATCH] Cheetah templates support to Cheetah templates support

Thanks for the patch, and it does handle Cheetah just fine. Cheetah is, I think, a somewhat special case in that many people have asked for Cheetah specifically. However, rather than just providing Cheetah support, I'd rather see an EntryPoint? created that provides objects for looking up templates and filling them in. With an EntryPoint?, it will be very easy to create a plugin Egg that will install with Cheetah and get the TG user up and running right away.

comment:4 Changed 14 years ago by kevin

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone set to 0.9

this is all done as of [384].

Note: See TracTickets for help on using tickets.