Drop support for ScrapyCommand.crawler property

This commit is contained in:
Julia Medina 2014-07-31 10:10:25 -03:00
parent 870438e5f4
commit d0edad4b0b
1 changed files with 1 additions and 27 deletions

View File

@ -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.