I've been experimenting with the Pylons ToscaWidgets (TW) sample with Pylons 0.9.3. Other than for fixing a couple of references in lib/base.py and lib/helpers.py the sample runs fine except for one strange problem. After I run paste and go to the URL for the sample in my browser I get the exception shown below. But when I refresh my browser the form works fine. Here is the exception from the initial http request :
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears Trunk" 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-trunk?hl=en -~----------~----~----~----~------~----~------~--~---
