Skip to content

Commit

Permalink
fix: accommodate docxtpl use of Part._rels
Browse files Browse the repository at this point in the history
  • Loading branch information
scanny committed May 1, 2024
1 parent 0ec5dcd commit 4cbbdab
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/docx/opc/part.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@ def related_parts(self):
@lazyproperty
def rels(self):
"""|Relationships| instance holding the relationships for this part."""
return Relationships(self._partname.baseURI)
# -- prevent breakage in `python-docx-template` by retaining legacy `._rels` attribute --
self._rels = Relationships(self._partname.baseURI)
return self._rels

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

0 comments on commit 4cbbdab

Please sign in to comment.