Filter out broken relationships such as those pointing to NULL.
()
| 553 | """Replace any relationships in this collection with those from `xml_rels`.""" |
| 554 | |
| 555 | def iter_valid_rels(): |
| 556 | """Filter out broken relationships such as those pointing to NULL.""" |
| 557 | for rel_elm in xml_rels.relationship_lst: |
| 558 | # --- Occasionally a PowerPoint plugin or other client will "remove" |
| 559 | # --- a relationship simply by "voiding" its Target value, like making |
| 560 | # --- it "/ppt/slides/NULL". Skip any relationships linking to a |
| 561 | # --- partname that is not present in the package. |
| 562 | if rel_elm.targetMode == RTM.INTERNAL: |
| 563 | partname = PackURI.from_rel_ref(base_uri, rel_elm.target_ref) |
| 564 | if partname not in parts: |
| 565 | continue |
| 566 | yield _Relationship.from_xml(base_uri, rel_elm, parts) |
| 567 | |
| 568 | self._rels.clear() |
| 569 | self._rels.update((rel.rId, rel) for rel in iter_valid_rels()) |
nothing calls this directly
no test coverage detected