On 04/05/2006, at 15:14, Michele Cella wrote:
> > Alberto Valverde wrote: >> >> I'm not sure it's the problem... I wanted Max to test the patch to >> confirm, but I'm pretty sure it is. Your proposal sounds good, >> however, I'm not sure how to implement it (maybe inspecting the >> 'path' at CP.request?) >> > > Using my memory, we can try something like this: > > if self.path and (self.path[0].widget is self): > [do the from_python thing] > > that means if the path is not empty and we are the top level widget in > the path (usually the form), anyway thinking about it this may cause > some problem when using display_field_for since here you directly pass > the value to the widget at display without passing it to a form... we > may need a better solution. > > Oh just comes to my mind, we can simply force convert=False to be used > by every CompoundWidget with it's members, we just need to cycle our > member widgets and put convert=False into > params["member_widgets_params"] for every member_widget that's not a > compound. > > something like this into update_params of a CompoundInputWidget will > work: > > def update_params(self, params): > ... > convert = dict() > for member in self.__class__.member_widgets: > for attr_name in self.__class__.member_widgets: > attr = getattr(self, attr_name, []) > if not isinstance(attr, list): > attr = [attr] > for widget in attr: > if not getattr(widget, "compound", False): > convert[widget.name] = False > params["member_widgets_params"]["convert"] = convert I like the idea... however, I think we should inject "convert=False" to compounds as well... keep in mind the first call to from_python (the form's, usually) will recursively call from_python on *every* child widget. 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 -~----------~----~----~----~------~----~------~--~---
