Brian Cole schrieb:
>> I want to set the options of the CheckBoxList field based upon a
>> variable/parameter which changes per request.
>
> Just pass the options in when display is called like so:
> <span py:replace="widget.display(options=options)" />
>
>> How can I do this? Is there a way to set a widget param from within
>> my controller? Can I access the request from within update_params?
>
> If you subclass the widget update_params is an option in conjunction
> with the cherrypy request object (which behaves like a dictionary with
> all your per request parameters). Just:
>
> from cherrypy import request
Another option that doesn't need subclassing is to pass a callable for
the options. Because cherrypy.request is thread-local and has all the
parameters bound to it, you can then build the options-list based on that.
def calc_options():
return model.Thing.select(model.Thing.q.attribute ==
cherrypy.request.params['the_param'])
Diez
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" 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?hl=en
-~----------~----~----~----~------~----~------~--~---