mirror of https://github.com/scrapy/scrapy.git
Apply suggestions from code review
Co-authored-by: Adrián Chaves <adrian@chaves.io>
This commit is contained in:
parent
72462a53e2
commit
af1be835e4
|
|
@ -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
|
||||
--------------------------
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue