Passing values to turbogears widgets at display time
In turbogears, I often need to pass data to widgets at display time. Sometimes it works automatically, but sometimes, in cases like passing option lists to CheckBoxLists or number of repetitions in a RepeatingFieldSet, it doesn't.
All the examples use precomputed lists or pass simple code functions. In most of my cases, I want them computed by the controller every time.
Passing a function hasn't worked, as I did not find any obvious way to have the function know about the controller.
So I need to pass things the display() method of the widgets, but I could not work out how to pass the option list and default list for a CheckBoxList that is part of a WidgetsList in a TableForm.
On IRC came the answer, thanks to Xentac:
you should be able to... tableform.display(options=dict(checkboxname=[optionlist]))
And yes, it works. I can pass the default value as one of the normal form values: