Add default Grid.iter_rows() implementation.

This commit is contained in:
Lance Edgar 2015-03-10 12:44:58 -05:00
parent 7c9e7cd138
commit d960738578

View file

@ -139,7 +139,13 @@ class Grid(Object):
return self.fields.itervalues() return self.fields.itervalues()
def iter_rows(self): def iter_rows(self):
raise NotImplementedError """
Iterate over the grid rows. The default implementation simply returns
an iterator over ``self.rows``; note however that by default there is
no such attribute. You must either populate that, or overrirde this
method.
"""
return iter(self.rows)
def render(self, template='/grids/grid.mako', **kwargs): def render(self, template='/grids/grid.mako', **kwargs):
kwargs.setdefault('grid', self) kwargs.setdefault('grid', self)