Skip to content

Commit 4cbbdab

Browse files
committed
fix: accommodate docxtpl use of Part._rels
1 parent 0ec5dcd commit 4cbbdab

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/docx/opc/part.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,9 @@ def related_parts(self):
145145
@lazyproperty
146146
def rels(self):
147147
"""|Relationships| instance holding the relationships for this part."""
148-
return Relationships(self._partname.baseURI)
148+
# -- prevent breakage in `python-docx-template` by retaining legacy `._rels` attribute --
149+
self._rels = Relationships(self._partname.baseURI)
150+
return self._rels
149151

150152
def target_ref(self, rId: str) -> str:
151153
"""Return URL contained in target ref of relationship identified by `rId`."""

0 commit comments

Comments
 (0)