The best way to do this is first of all to pass a function argument to
populate your options at runtime, and then provide the default:

def get_topics():
    return (t.id, t.name) for t in Topic.select()

W.CheckBoxList(name='topics',options=get_topics,
validator=ForEach(convert_to_list=True))

In your controller method for example:

@turbogears.expose(template='myapp.templates.welcome')
def index(self, *args, **kw):
    cherrypy.request.input_values={''topics':identity.user.topics}
    return dict()

Reply via email to