Changeset 1941:0e63b80718c7
- 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:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r1657
|
r1941
|
|
| 8 | 8 | import scrapy |
| 9 | 9 | from scrapy import log |
| 10 | | from scrapy.spider import spiders |
| 11 | 10 | from scrapy.xlib import lsprofcalltree |
| 12 | 11 | from scrapy.conf import settings |
| 13 | 12 | from scrapy.command.models import ScrapyCommand |
| | 13 | from scrapy.utils.signal import send_catch_log |
| 14 | 14 | |
| 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 |
| | 17 | command_executed = object() |
| 24 | 18 | |
| 25 | 19 | def _find_commands(dir): |
| … |
… |
|
| 128 | 122 | |
| 129 | 123 | 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) |
| 131 | 126 | from scrapy.core.manager import scrapymanager |
| 132 | 127 | scrapymanager.configure(control_reactor=True) |