One function
Manifest in ernestofgonzalez/epub-utils
The author described this change as “Fix missing namespace for manifest”. It counts as a record because the check below fails on the code as it stood at 99bbacf03 and passes on f276869ee, with nothing else changed between the two runs.
Projecternestofgonzalez/epub-utils
Fix saved2025-05-11
Sharing licenceApache-2.0 · LICENSE
Change size+4 −1
What the code was meant to do, written into the code itself as a docstring
Represents the manifest section of an EPUB package document. The manifest element provides an exhaustive list of the publication resources.
The change
| 4 | 4 | The manifest element provides an exhaustive list of the publication resources. | |
| 5 | 5 | """ | |
| 6 | 6 | ||
| 7 | + | NAMESPACE = "http://www.idpf.org/2007/opf" | |
| 8 | + | ITEM_XPATH = f".//{{{NAMESPACE}}}item" | |
| 9 | + | ||
| 7 | 10 | def __init__(self, xml_content: str): | |
| 8 | 11 | self.xml_content = xml_content | |
| 9 | 12 | self.items = [] | |
| ⋯ | |||
| 27 | 30 | xml_content = xml_content.encode("utf-8") | |
| 28 | 31 | root = etree.fromstring(xml_content) | |
| 29 | 32 | ||
| 30 | - | for item in root.findall('.//item'): | |
| 33 | + | for item in root.findall(self.ITEM_XPATH): | |
| 31 | 34 | item_data = { | |
| 32 | 35 | 'id': item.get('id'), | |
| 33 | 36 | 'href': item.get('href'), | |
The check that tells the two apart
fail→pass·tests/test_doc.py::test_document_package
Check file tests/test_doc.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before it99bbacf036c7ea0c266d86aa252542a1d5fd8a81
Broken version dated2025-05-11
Moduleepub_utils.package.manifest
Units changedManifest
Fingerprint033320a7212b6c36
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.