From af1be835e4a6c14634acb382568935c1a7e10445 Mon Sep 17 00:00:00 2001 From: Andrey Rakhmatullin Date: Wed, 2 Aug 2023 19:46:16 +0400 Subject: [PATCH] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Adrián Chaves --- docs/topics/settings.rst | 4 ++-- docs/topics/spiders.rst | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/topics/settings.rst b/docs/topics/settings.rst index d0f2acd89..0963f835f 100644 --- a/docs/topics/settings.rst +++ b/docs/topics/settings.rst @@ -81,7 +81,7 @@ to do so is by setting their :attr:`~scrapy.Spider.custom_settings` attribute: "SOME_SETTING": "some value", } -It's often better to provide a :meth:`~scrapy.Spider.update_settings` instead, +It's often better to implement :meth:`~scrapy.Spider.update_settings` instead, and settings set there should use the "spider" priority explicitly: .. code-block:: python @@ -94,8 +94,8 @@ and settings set there should use the "spider" priority explicitly: @classmethod def update_settings(cls, settings): - settings.set("SOME_SETTING", "some value", priority="spider") super().update_settings(settings) + settings.set("SOME_SETTING", "some value", priority="spider") 3. Project settings module -------------------------- diff --git a/docs/topics/spiders.rst b/docs/topics/spiders.rst index 97b525bd6..5c3bf6e72 100644 --- a/docs/topics/spiders.rst +++ b/docs/topics/spiders.rst @@ -162,7 +162,7 @@ scrapy.Spider settings, spider attributes or other factors and use setting priorities other than ``'spider'``. Also, it's easy to extend ``update_settings()`` in a subclass by overriding it, while doing the same with - :attr:`~scrapy.Spider.custom_settings` is hard or impossible. + :attr:`~scrapy.Spider.custom_settings` can be hard. For example, suppose a spider needs to modify :setting:`FEEDS`: @@ -182,8 +182,8 @@ scrapy.Spider @classmethod def update_settings(cls, settings): - settings.setdefault("FEEDS", {}).update(cls.custom_feed) super().update_settings(settings) + settings.setdefault("FEEDS", {}).update(cls.custom_feed) .. method:: start_requests()