From e2c0aa14bacec40c2dac0450e71ad59c53500b66 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 7 Aug 2012 17:03:29 -0700 Subject: [PATCH] fix Grid.get_row_attrs() --- edbob/pyramid/grids/core.py | 8 ++++++-- edbob/pyramid/templates/grids/grid.mako | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/edbob/pyramid/grids/core.py b/edbob/pyramid/grids/core.py index 2aeeb25..9cb0e94 100644 --- a/edbob/pyramid/grids/core.py +++ b/edbob/pyramid/grids/core.py @@ -49,6 +49,7 @@ class Grid(edbob.Object): checkboxes = False deletable = False partial_only = False + row_attrs = None def __init__(self, request, **kwargs): kwargs.setdefault('fields', OrderedDict()) @@ -98,5 +99,8 @@ class Grid(edbob.Object): attrs = {'class_': 'odd' if i % 2 else 'even'} return attrs - def row_attrs(self, row, i): - return format_attrs(**self._row_attrs(row, i)) + def get_row_attrs(self, row, i): + attrs = self._row_attrs(row, i) + if self.row_attrs: + attrs.update(self.row_attrs(row, i)) + return format_attrs(**attrs) diff --git a/edbob/pyramid/templates/grids/grid.mako b/edbob/pyramid/templates/grids/grid.mako index 84c12f6..78542b4 100644 --- a/edbob/pyramid/templates/grids/grid.mako +++ b/edbob/pyramid/templates/grids/grid.mako @@ -18,7 +18,7 @@ % for i, row in enumerate(grid.iter_rows(), 1): - + % if grid.checkboxes: ${grid.checkbox(row)} % endif