File: enginestatus.py

package info (click to toggle)
python-scrapy 0.8-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 2,904 kB
  • ctags: 2,981
  • sloc: python: 15,349; xml: 199; makefile: 68; sql: 64; sh: 34
file content (27 lines) | stat: -rw-r--r-- 782 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""
Scheduler information module for Scrapy webconsole
"""
from scrapy.xlib.pydispatch import dispatcher
from scrapy.utils.engine import get_engine_status
from scrapy.management.web import banner

class EngineStatus(object):
    webconsole_id = 'enginestatus'
    webconsole_name = 'Engine status'

    def __init__(self):
        from scrapy.management.web import webconsole_discover_module
        dispatcher.connect(self.webconsole_discover_module, signal=webconsole_discover_module)

    def webconsole_render(self, wc_request):
        s = banner(self)
        s += "<pre><code>\n"
        s += get_engine_status()
        s += "</pre></code>\n"
        s += "</body>\n"
        s += "</html>\n"

        return s

    def webconsole_discover_module(self):
        return self