#36535: Ensure compatibility with docutils 0.19 through 0.22+ in admindocs
-------------------------------------+-------------------------------------
Reporter: Natalia | Owner: Natalia Bidart
Bidart |
Type: Bug | Status: assigned
Component: | Version: 5.2
contrib.admindocs |
Severity: Release | Keywords: parse_rst docutils
blocker |
Triage Stage: | Has patch: 1
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Docutils 0.22 introduced a breaking-ish change that affects how the
`writer` argument is handled in `docutils.core.publish_parts()`, which is
used in admindocs' `parse_rst()`.
In version 0.22 and above, the `writer` argument can be an instance *or* a
string. Earlier versions (0.19 through 0.21) only support passing the
writer name as a string via `writer_name`, *or* passing an instance
directly to `writer`, but not both interchangeably.
An earlier patch (65ab92f6a83644bbb555d0eff3a02d8d9301aba4) was backported
to Django 5.2.x to avoid test failures and runtime errors with docutils
0.22+, since Django does not currently restrict the dependency beyond
requiring version 0.19 or higher. However, that patch introduced a
backward incompatibility with docutils < 0.22, which now fails due to the
changed usage pattern.
To fix this, a version-agnostic approach is proposed: explicitly
instantiate the writer and avoid use of `writer_name`. This ensures
compatibility with all currently supported docutils versions without
needing to bump the minimum required version.
--
Ticket URL: <
https://code.djangoproject.com/ticket/36535>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.