55<w:document>.
66"""
77
8- from ..ns import qn
98from ..table import CT_Tbl
109from ..xmlchemy import BaseOxmlElement , ZeroOrOne , ZeroOrMore
1110
@@ -32,6 +31,7 @@ class CT_Body(BaseOxmlElement):
3231 """
3332 p = ZeroOrMore ('w:p' , successors = ('w:sectPr' ,))
3433 tbl = ZeroOrMore ('w:tbl' , successors = ('w:sectPr' ,))
34+ sectPr = ZeroOrOne ('w:sectPr' , successors = ())
3535
3636 def add_section_break (self ):
3737 """
@@ -57,7 +57,7 @@ def clear_content(self):
5757 Remove all content child elements from this <w:body> element. Leave
5858 the <w:sectPr> element if it is present.
5959 """
60- if self ._sentinel_sectPr is not None :
60+ if self .sectPr is not None :
6161 content_elms = self [:- 1 ]
6262 else :
6363 content_elms = self [:]
@@ -69,25 +69,9 @@ def _append_blocklevelelt(self, block_level_elt):
6969 Return *block_level_elt* after appending it to end of
7070 EG_BlockLevelElts sequence.
7171 """
72- sentinel_sectPr = self ._sentinel_sectPr
73- if sentinel_sectPr is not None :
74- sentinel_sectPr .addprevious (block_level_elt )
72+ sectPr = self .sectPr
73+ if sectPr is not None :
74+ sectPr .addprevious (block_level_elt )
7575 else :
7676 self .append (block_level_elt )
7777 return block_level_elt
78-
79- @property
80- def _sentinel_sectPr (self ):
81- """
82- Return ``<w:sectPr>`` element appearing as last child, or None if not
83- found. Note that the ``<w:sectPr>`` element can also occur earlier in
84- the body; here we're only interested in one occuring as the last
85- child.
86- """
87- if len (self ) == 0 :
88- sentinel_sectPr = None
89- elif self [- 1 ].tag != qn ('w:sectPr' ):
90- sentinel_sectPr = None
91- else :
92- sentinel_sectPr = self [- 1 ]
93- return sentinel_sectPr
0 commit comments