hmmm, this doesn't work for me, I get the following traceback on starting
the app (start-xxx.py):

Traceback (most recent call last):
  File "E:\data\code\TurboGears\webtoolspy\start-webtools.py", line 33, in ?
    from webtools.controllers import Root
  File "E:\data\code\TurboGears\webtoolspy\webtools\controllers.py", line
28, in
 ?
    from subcontrollers.projectcontroller import Projects
  File
"E:\data\code\TurboGears\webtoolspy\webtools\subcontrollers\projectcontro
ller.py", line 18, in ?
    import webtools.appwidgets.invoicewidgets as iw
  File
"E:\data\code\TurboGears\webtoolspy\webtools\appwidgets\invoicewidgets.py
", line 19, in ?
    class InvoiceFormFields(widgets.WidgetsList):
  File
"E:\data\code\TurboGears\webtoolspy\webtools\appwidgets\invoicewidgets.py
", line 22, in InvoiceFormFields
    options=get_billable_items_options,
  File "d:\python24\lib\site-packages\TurboGears-
1.0.1-py2.4.egg\turbogears\widg
ets\meta.py", line 142, in widget_init
    func(self, *args, **kw)
  File "d:\python24\lib\site-packages\TurboGears-
1.0.1-py2.4.egg\turbogears\widg
ets\forms.py", line 837, in __init__
    validator = self._guess_validator()
  File "d:\python24\lib\site-packages\TurboGears-
1.0.1-py2.4.egg\turbogears\widg
ets\forms.py", line 857, in _guess_validator
    sample_option = self._get_sample_option()
  File "d:\python24\lib\site-packages\TurboGears-
1.0.1-py2.4.egg\turbogears\widg
ets\forms.py", line 870, in _get_sample_option
    options = self._extend_options(self.options)
  File "d:\python24\lib\site-packages\TurboGears-
1.0.1-py2.4.egg\turbogears\widg
ets\meta.py", line 95, in __get__
    return param()
  File
"E:\data\code\TurboGears\webtoolspy\webtools\appwidgets\invoicewidgets.py
", line 13, in get_billable_items_options
    bis = BillableItem.select(BillableItem.q.projectID ==
cherrypy.request.param
s['project_id'])
  File "D:\Python24\lib\site-packages\cherrypy-
2.2.1-py2.4.egg\cherrypy\__init__
.py", line 42, in __getattr__
    childobject = getattr(serving, self.__attrname__)
AttributeError: 'thread._local' object has no attribute 'request'

Kevin Horn

On 8/9/07, Diez B. Roggisch <[EMAIL PROTECTED]> wrote:
>
>
> 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to