Hi,
I have a problem with the select shuttle widget. At the moment I have a
helper function that takes a sqlobject select() set in and turns it into
a list of options. This is a closure that being returned like
(simplified):
def a(selection):
def b():
return [(key,value),...]
return b
However when giving this to the select shuttle as selected_options at
rendertime via value it returns:
File
"/usr/lib/python2.4/site-packages/TurboGears-1.0.1-py2.4.egg/turbogears/widgets/base.py",
line 352, in display
return super(CompoundWidget, self).display(value, **params)
File
"/usr/lib/python2.4/site-packages/TurboGears-1.0.1-py2.4.egg/turbogears/widgets/forms.py",
line 51, in _update_path
returnval = func(self, *args, **kw)
File
"/usr/lib/python2.4/site-packages/TurboGears-1.0.1-py2.4.egg/turbogears/widgets/forms.py",
line 236, in display
return super(InputWidget, self).display(value, **params)
File
"/usr/lib/python2.4/site-packages/TurboGears-1.0.1-py2.4.egg/turbogears/widgets/base.py",
line 261, in display
self.update_params(params)
File
"/home/fabian/workingCopy/external/lib/Select_Shuttle-1.1.1-py2.4.egg/selectshuttle/widgets.py",
line 237, in update_params
available_opts = filter(not_selected, available_opts)
File
"/home/fabian/workingCopy/external/lib/Select_Shuttle-1.1.1-py2.4.egg/selectshuttle/widgets.py",
line 236, in <lambda>
not_selected = lambda x: x not in selected_opts
TypeError: iterable argument required
Now I understand that I'm passing a function instead of an iterable but
the function passed at instantiation time as available_options=a(selection)
works like a charm. How can I make a list out of the results of the
function? I tried google but I'm relatively new to python and a lot of
what I found in regards to callable, closures and the lot went a bit over
my head. Thank you,
Fabian
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---