Changeset 1941:0e63b80718c7

Show
Ignore:
Timestamp:
03/04/10 10:58:18 (5 months ago)
Author:
Pablo Hoffman <pablo@…>
Branch:
default
Message:

replaced hacky command_executed dict by standard signal

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • scrapy/command/cmdline.py

    r1657 r1941  
    88import scrapy 
    99from scrapy import log 
    10 from scrapy.spider import spiders 
    1110from scrapy.xlib import lsprofcalltree 
    1211from scrapy.conf import settings 
    1312from scrapy.command.models import ScrapyCommand 
     13from scrapy.utils.signal import send_catch_log 
    1414 
    15 # This dict holds information about the executed command for later use 
    16 command_executed = {} 
    17  
    18 def _save_command_executed(cmdname, cmd, args, opts): 
    19     """Save command executed info for later reference""" 
    20     command_executed['name'] = cmdname 
    21     command_executed['class'] = cmd 
    22     command_executed['args'] = args[:] 
    23     command_executed['opts'] = opts.__dict__.copy() 
     15# Signal that carries information about the command which was executed 
     16# args: cmdname, cmdobj, args, opts 
     17command_executed = object() 
    2418 
    2519def _find_commands(dir): 
     
    128122 
    129123    del args[0]  # remove command name from args 
    130     _save_command_executed(cmdname, cmd, args, opts) 
     124    send_catch_log(signal=command_executed, cmdname=cmdname, cmdobj=cmd, \ 
     125        args=args, opts=opts) 
    131126    from scrapy.core.manager import scrapymanager 
    132127    scrapymanager.configure(control_reactor=True)