Skip to content

Commit bb8b718

Browse files
author
Steve Canny
committed
tbl: base _Rows on Parented
1 parent 6b71715 commit bb8b718

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

docx/table.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def rows(self):
5858
"""
5959
|_Rows| instance containing the sequence of rows in this table.
6060
"""
61-
return _Rows(self._tbl)
61+
return _Rows(self._tbl, self)
6262

6363
@property
6464
def style(self):
@@ -258,13 +258,13 @@ def __len__(self):
258258
return len(self._tr.tc_lst)
259259

260260

261-
class _Rows(object):
261+
class _Rows(Parented):
262262
"""
263263
Sequence of |_Row| instances corresponding to the rows in a table.
264264
Supports ``len()``, iteration and indexed access.
265265
"""
266-
def __init__(self, tbl):
267-
super(_Rows, self).__init__()
266+
def __init__(self, tbl, parent):
267+
super(_Rows, self).__init__(parent)
268268
self._tbl = tbl
269269

270270
def __getitem__(self, idx):

tests/test_table.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ def it_raises_on_indexed_access_out_of_range(self, rows_fixture):
356356
def rows_fixture(self):
357357
row_count = 2
358358
tbl = _tbl_bldr(rows=row_count, cols=2).element
359-
rows = _Rows(tbl)
359+
rows = _Rows(tbl, None)
360360
return rows, row_count
361361

362362

0 commit comments

Comments
 (0)