Error(TypeError): object does not support item assignment
/usr/lib/python2.4/site-packages/ToscaWidgetsForms-0.1a0dev_r2217-py2.4.egg/toscawidgets/forms/fields.py
line 240
237:
238: def update_params(self, d):
239: super(Form, self).update_params(d)
240: d['value']['_submit'] = d['submit_text'] <<HERE
241:
The debugger shows me that the value of d['value'] is None. Looking
further back into TW's Widget class definition, the prepare_dict method
has this code:
/usr/lib/python2.4/site-packages/ToscaWidgets-0.1a0dev_r2235-py2.4.egg/toscawidgets/core.py
416 if value is None:
417 value = self.default
418 value = d['value'] = self.adapt_value(value)
Using the debugger again I see that the value of 'value' at line 416 is
an empty string. Since the expression (value is None) is False the null
string passes through to line 418. In turn, the debugger shows the
return value of self.adapt_value(value) to be None when value is an
empty string. So of course d['value'] can't subsequently be indexed
since it is not a dict. Forcing value, in this case, to be an empty
dict eliminates the exception.
Hopefully this analysis is of some help.
Cheers,
Bill
On Dec 20, 10:48 am, "Bill" <wtren...@gmail.com> wrote:
> I've been experimenting with the Pylons ToscaWidgets (TW) sample with
<snip>
A bit of confusion here. I originally posted this on the
pylons-discuss group but it didn't show up for hours so I thought
something was wrong. I decided to then post here to see if it would
get through to Alberto one way or another. Well, a day later my
original post shows up on pylons-discuss and Alberto has addressed it
there. I didn't realize the posts on Google Groups take so long to
arrive.
Sorry for the confusion,
Bill
> A bit of confusion here. I originally posted this on the
> pylons-discuss group but it didn't show up for hours so I thought
> something was wrong. I decided to then post here to see if it would
> get through to Alberto one way or another. Well, a day later my
> original post shows up on pylons-discuss and Alberto has addressed it
> there. I didn't realize the posts on Google Groups take so long to
> arrive.
I wouldn't be surprised if Ben has the pylons list set up the same
way the TG lists are: new members are moderated. It prevents spam
from making it through.
Kevin