[Bug 4769] Add a way to get the whole object in objectlist.Column's format_func
bugzilla-daemon at async.com.br
bugzilla-daemon at async.com.br
Mon Nov 28 11:28:24 BRST 2011
http://bugs.async.com.br/show_bug.cgi?id=4769
--- Comment #4 from Ronaldo Maia <romaia at async.com.br> 2011-11-28 11:28:24 BRST ---
(In reply to comment #3)
> > data_type = self.data_type
> > if data is None and data_type != gdk.Pixbuf:
> > text = ''
> > elif self.format_func:
> >- text = self.format_func(data)
> >+ if self.format_func_data is not None:
> >+ text = self.format_func(obj, self.format_func_data)
> >+ else:
> >+ text = self.format_func(data)
>
> That can be replaced with:
>
> text = self.format_func(data, self.format_func_data)
That not only is not necessary (self.format_func_data will be None in this case
- se the if), but it would also break anywhere that already uses format_func
(they do not expect a second argument).
> > def renderer_func(self, renderer, data):
> >- if self._use_data_model:
> >+ if not self._use_data_model:
> >+ data = self.get_attribute(data, self.attribute, None)
> >+
> >+ if self.format_func_data is not None:
> >+ ret = self._data_func(data, self.format_func_data)
> >+ else:
> > ret = self._data_func(data)
> >- else:
> >- attr_data = self.get_attribute(data, self.attribute, None)
> >- ret = self._data_func(attr_data)
>
> And this with:
>
> ret = self._data_func(attr_data, self.format_func_data)
>
>
> It'll save a couple of lines of code and make it easier to read.
Same here, It would break callsites already using _data_func
> Looks good apart from that, no need for additional review.
--
Configure bugmail: http://bugs.async.com.br/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA Contact for the bug.
More information about the Kiwi
mailing list