Passing values to turbogears widgets at display time (the general case)
Last time I dug this up I was not clear enough in documenting my findings, so I had to find them again. Here is the second attempt.
In Turbogears, in order to pass parameters to arbitrary widgets in a compound widget, the syntax is:
form.display(PARAMNAME=dict(WIDGETNAME=VALUE))
And if you have more complex nested widgets and would like to know what goes on, this monkey patch is good for inspecting the params lookup functions:
import turbogears.widgets.forms
old_rpbp = turbogears.widgets.forms.retrieve_params_by_path
def inspect_rpbp(params, path):
print "RPBP", repr(params), repr(path)
res = old_rpbp(params, path)
print "RPBP RES", res
return res
turbogears.widgets.forms.retrieve_params_by_path = inspect_rpbp
The code for the lookup itself is, as the name suggests, in the
retrieve_params_by_path
function in the file widgets/forms.py
in the
Turbogears source code.