On 04/05/2006, at 18:36, Max Ischenko wrote:
> Unfortunately that doesn't help either. My app is rather ... uh
> involved so
> it's not easy to extract a meaninful part of it. Basically, it goes
> like
> this:
>
> class MyDataController:
> def __init__(self, *args, **kw):
> ...
> w1 = formmaker.fields_for(self.sql_class,
> self.form_fields)
> w2 = formmaker.fields_for(self.aux_sql_class,
> self.aux_form_fields)
> fields = w2 + w1 + [widgets.HiddenField('referrer')]
> self.form_widget = self.form_widget_class(fields=fields) #
> TableForm it is
>
> @turbogears.expose()
> def edit(self, obj):
> return dict(tg_template=self.form_template,
> form=self.form_widget,
> obj=obj, action="update")
>
> On failure, relevant stack elements are (got with fancy_traceback):
>
> Module turbogears.widgets.forms:216 in adjust_value
> input_submitted False
> iv None
> no_input_if_empty False
> params {'action': 'update', 'convert': True, 'disabled_fields': set
> ([]),
> 'fields': [TextField(name='give...n_id', convert=True, label='Given
> ID',
> attrs={}, css_classes=None, help_text=None, field_class='textfield'),
> TextField(name='ext_id', convert=True, label='External ID', attrs={},
> css_classes=None, help_text=None, field_class='textfield'),
> TextField(name='source_url', convert=True, label='Source URL',
> attrs={},
> css_classes=None, help_text=None, field_class='textfield'),
> TextField(name='source_title', convert=True, label='Source title',
> attrs={},
> css_classes=None, help_text=None, field_class='textfield'),
> TextField(name='source_author', convert=True, label='Source author',
> attrs={}, css_classes=None, help_text=None, field_class='textfield'),
> CalendarDateTimePicker(name='source_published', convert=True,
> format='%Y/%m/%d %H:%M', button_text='Choose', picker_shows_time=True,
> label='Source publish datetime', attrs={}, css_classes=None,
> help_text=None,
> field_class='calendardatetimepicker'), TextField(name='language',
> convert=True, label='Language', attrs={}, css_classes=None,
> help_text=None,
> field_class='textfield'), DataCheckBoxList(name='tags', convert=True,
> label='Tags', css_classes=None, help_text=None,
> field_class='datacheckboxlist', list_attrs={}, options=[]),
> TextField(name='name', convert=True, label='Name', attrs={},
> css_classes=None, help_text=None, field_class='textfield'),
> TextField(name='subtype', convert=True, label='Subtype', attrs={},
> css_classes=None, help_text=None, field_class='textfield'),
> HiddenField(name='referrer', convert=True, label='Referrer', attrs={},
> css_classes=None, help_text=None, field_class='hiddenfield')],
> 'form_attrs':
> {}, 'hidden_fields': [], 'member_widgets_params': {'action': 'update',
> 'submit_text': 'Edit Collection'}, 'method': 'post', 'name': 'form',
> 'submit': SubmitButton(name='widget', convert=True, label=None,
> attrs={},
> css_classes=None, help_text=None, field_class='submitbutton'),
> 'submit_text': 'Edit Collection', 'table_attrs': {'cellpadding': 2,
> 'cellspacing': 0, 'border': 0}}
> self TableForm(name='form', submit_text=None, convert=True,
> table_attrs={'cellpadding': 2, 'border': 0, '...cellspacing': 0},
> method='post', action=None, disabled_fields=set([]), form_attrs={})
> value <Spacoll 86 name=u'my collection' subtype=u'facts'
> resourceID=115L>
>
> Module formencode.api:353 in from_python
> self <Schema object 245 chained_validators=[] fields={'source_title':
> <NullValidator object 249>..., 'ext_id': <NullValidator object 247>,
> 'language': <NullValidator object 251>, 'tags': <MultipleSelection
> object
> 244 validatorArgs=(<Set object 71>,) validators=[<Set object 71>]>,
> 'given_id': <NullValidator object 246>, 'source_published':
> <DateTimeConverter object allow_empty=False format='%Y/%m/%d %H:%M'>,
> 'source_author': <NullValidator object 250>, 'source_url':
> <NullValidator
> object 248>, 'subtype': <NullValidator object 253>, 'referrer':
> <NullValidator object 254>, 'name': <NullValidator object 252>}
> pre_validators=[]>
> state None
> value <Spacoll 86 name=u'my collection' subtype=u'facts'
> resourceID=115L>
>
> HTH,
> Max.I see, the problem is that the form is getting an SQLobject instance instead of a dict as a value, when from_python is executed on it it fails as it expects a dict. Since [1344] from_python is executed for conversion in adjust_value for CompoundWidgets too, therefore this bug has raised. One possible solution (or workaround) could be to so_to_dict SO instances in validators.Schema.from_python.... Though maybe a final solution would be to fix fastdata to send a "so_to_dicted" SO to the form...Opinions? Can you try this patch see if, at least, we've found the cause? Alberto --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
from_python.patch.3.gz
Description: GNU Zip compressed data
