From 61e6bfc023e580dbcd601b6a694122ef2534039b Mon Sep 17 00:00:00 2001 From: Andrey Rakhmatullin Date: Wed, 13 Sep 2023 12:35:15 +0400 Subject: [PATCH] Docs improvements. --- docs/topics/settings.rst | 3 ++- docs/topics/spiders.rst | 7 +++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/topics/settings.rst b/docs/topics/settings.rst index 65823e071..d3fe6bbe2 100644 --- a/docs/topics/settings.rst +++ b/docs/topics/settings.rst @@ -115,7 +115,8 @@ arguments ` or other logic: @classmethod def from_crawler(cls, crawler, *args, **kwargs): spider = super().from_crawler(crawler, *args, **kwargs) - spider.settings.set("SOME_SETTING", kwargs["value"], priority="spider") + if "value" in kwargs: + spider.settings.set("SOME_SETTING", kwargs["value"], priority="spider") return spider 3. Project settings module diff --git a/docs/topics/spiders.rst b/docs/topics/spiders.rst index 4ed9b8dc3..d9cbbe35a 100644 --- a/docs/topics/spiders.rst +++ b/docs/topics/spiders.rst @@ -138,11 +138,10 @@ scrapy.Spider .. versionchanged:: VERSION - The settings available in this method can now be modified, which is + The settings in ``crawler.settings`` can now be modified, which is handy if you want to modify them based on arguments. As a - consequence, the settings available in this method aren't the final - values as they can be modified later by e.g. :ref:`add-ons - `. + consequence, these settings aren't the final values as they can be + modified later by e.g. :ref:`add-ons `. :param crawler: crawler to which the spider will be bound :type crawler: :class:`~scrapy.crawler.Crawler` instance