scrapy/docs
Mohammad Hassan f7382561cf Do not fail to disable a component with an unimportable path
`get_component_priority_dict_with_base()` normalizes every key of a
component priority dictionary by calling `load_object()` on it, including
keys whose value is `None`, i.e. components the user is disabling.

`normalize_key()` only guarded against `(NameError, TypeError, ValueError)`,
the three exceptions `load_object()` raises itself, but not against the
`ImportError` raised by the `import_module()` call it makes. A stale entry
disabling a component whose module no longer exists, e.g.
`{"scrapy.webservice.WebService": None}`, therefore aborted settings
resolution with `ModuleNotFoundError` instead of being ignored.

Add `ImportError` to the guard so that an unimportable key falls back to its
raw string form. Since its value is `None`, it is then dropped by the
existing `if v is not None` filter, and disabling by import path keeps
working. Enabled components with an unimportable path are unaffected:
`MiddlewareManager.from_crawler()` calls `load_object()` on them again and
still fails there.

Fixes #7820

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-09 20:08:58 -04:00
..
_ext Fix small documentation wording issues (#7480) 2026-05-04 08:43:21 +02:00
_static Feature the new logo in the README (#6831) 2025-06-06 12:43:56 +05:00
_templates fix typos (#7564) 2026-06-02 11:04:38 +02:00
_tests Remove trailing whitespace 2025-03-11 11:56:44 +01:00
intro Make brotli a hard dependency (#7929) 2026-08-09 19:24:14 +02:00
topics Document how to customize media pipeline file names from responses (#7909) 2026-08-09 23:08:59 +05:00
utils IOError and other cleanup (#4716) 2023-06-21 20:08:53 +02:00
Makefile chore(docs): refactor config (#6623) 2025-01-20 12:18:30 +01:00
conf.py Create a page on optimization (#7938) 2026-08-09 18:37:24 +02:00
conftest.py adding black formatter to all the code 2022-11-29 11:30:46 -03:00
contributing.rst Use external mitmproxy. (#7720) 2026-07-09 17:02:05 +02:00
faq.rst Add a cookies documentation page (#7947) 2026-08-09 22:41:32 +05:00
index.rst Add a cookies documentation page (#7947) 2026-08-09 22:41:32 +05:00
news.rst Do not fail to disable a component with an unimportable path 2026-08-09 20:08:58 -04:00
requirements.in Create a page on optimization (#7938) 2026-08-09 18:37:24 +02:00
requirements.txt Create a page on optimization (#7938) 2026-08-09 18:37:24 +02:00
versioning.rst Assorted docs fixes, part 1. (#7710) 2026-07-07 18:39:34 +05:00