Scrapy, a fast high-level web crawling & scraping framework for Python.
replaced hacky command_executed dict by standard signal
Pablo Hoffman4c1ec0c97ec8
diff --git a/scrapy/command/cmdline.py b/scrapy/command/cmdline.pyindex 25f531cea..e51b7e8bf 100644--- a/scrapy/command/cmdline.py+++ b/scrapy/command/cmdline.py@@ -7,20 +7,14 @@ import cProfileimport scrapyfrom scrapy import log-from scrapy.spider import spidersfrom scrapy.xlib import lsprofcalltreefrom scrapy.conf import settingsfrom scrapy.command.models import ScrapyCommand+from scrapy.utils.signal import send_catch_log-# This dict holds information about the executed command for later use-command_executed = {}--def _save_command_executed(cmdname, cmd, args, opts):- """Save command executed info for later reference"""- command_executed['name'] = cmdname- command_executed['class'] = cmd- command_executed['args'] = args[:]- command_executed['opts'] = opts.__dict__.copy()+# Signal that carries information about the command which was executed+# args: cmdname, cmdobj, args, opts+command_executed = object()def _find_commands(dir):try:@@ -127,7 +121,8 @@ def execute(argv=None):sys.exit(2)del args[0] # remove command name from args- _save_command_executed(cmdname, cmd, args, opts)+ send_catch_log(signal=command_executed, cmdname=cmdname, cmdobj=cmd, \+ args=args, opts=opts)from scrapy.core.manager import scrapymanagerscrapymanager.configure(control_reactor=True)ret = _run_command(cmd, args, opts)