提交 d0edad4b 编写于 作者: J Julia Medina

Drop support for ScrapyCommand.crawler property

上级 870438e5
......@@ -2,12 +2,11 @@
Base class for Scrapy commands
"""
import os
import warnings
from optparse import OptionGroup
from twisted.python import failure
from scrapy.utils.conf import arglist_to_dict
from scrapy.exceptions import UsageError, ScrapyDeprecationWarning
from scrapy.exceptions import UsageError
class ScrapyCommand(object):
......@@ -27,31 +26,6 @@ class ScrapyCommand(object):
assert not hasattr(self, '_crawler'), "crawler already set"
self._crawler = crawler
@property
def crawler(self):
warnings.warn("Command's default `crawler` is deprecated and will be removed. "
"Use `create_crawler` method to instatiate crawlers.",
ScrapyDeprecationWarning)
if not hasattr(self, '_crawler'):
crawler = self.crawler_process.create_crawler()
old_start = crawler.start
self.crawler_process.started = False
def wrapped_start():
if self.crawler_process.started:
old_start()
else:
self.crawler_process.started = True
self.crawler_process.start()
crawler.start = wrapped_start
self.set_crawler(crawler)
return self._crawler
def syntax(self):
"""
Command syntax (preferably one-line). Do not include command name.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册