You could use the custom_format parameter to achieve the same thing
with less code:
from tg.decorators import use_custom_format
class MyCrazyController(TGController):
def __init__(self, is_shouting=False):
self.is_shouting = is_shouting
@expose('genshi:regular_template', custom_format='default_voice')
@expose('genshi:shouting_template', custom_format='shouting')
def index(self, *args, **kw):
use_custom_format(self.index, self.is_shouting and 'shouting'
or 'default_voice')
return dict(john_wayne="you got that right, kid")
--
Lee McFadden
blog: http://www.splee.co.uk
rejaw: http://rejaw.com/splee
twitter: http://twitter.com/splee
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears Trunk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/turbogears-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---