I have a question regarding exposing attributes
to templates in TurboGears. Let's say I have
a main.kid template. When I want to pass an
attribute called 'music', I could do something
like this:
@turbogears.expose(template="main")
def index(self):
return dict(music="Jazz")
main.kid:
<span py:replace="music">music</span>
---
How about if I have a 'mood' attribute?
def __init__(self):
self.mood = "mellow"
Obviously, I could add mood to the return dict:
@turbogears.expose(template="main")
def index(self):
return dict(music="Jazz",
mood=self.mood)
But what if I've got 20 or 30 different attributes
that I want exposed in the template? And what if I
have several plaes where I invoke the template?
Must I build and return a dict of values each time or
is there a simpler way for these attributes to be
accessed from main.kid?