# HG changeset patch # User Sylvain Thénault # Date 1304955748 -7200 # Node ID c6d8c3ce4a3ec2c82f140328bfe3c6860dccb18d # Parent b9eaad6e34c35513097b428a8228b5010e216e9b [view] ability to define a column header through custom label_column_ method, useful for table view to customize a specific column without specifying others diff -r b9eaad6e34c3 -r c6d8c3ce4a3e view.py --- a/view.py Mon May 09 16:12:17 2011 +0200 +++ b/view.py Mon May 09 17:42:28 2011 +0200 @@ -447,11 +447,14 @@ rqlstdescr = self.cw_rset.syntax_tree().get_description(mainindex, translate)[0] labels = [] - for colindex, label in enumerate(rqlstdescr): - # compute column header - if label == 'Any': # find a better label - label = ','.join(translate(et) - for et in self.cw_rset.column_types(colindex)) + for colidx, label in enumerate(rqlstdescr): + try: + label = getattr(self, 'label_column_%s' % colidx)() + except AttributeError: + # compute column header + if label == 'Any': # find a better label + label = ','.join(translate(et) + for et in self.cw_rset.column_types(colidx)) labels.append(label) return labels