diff --git a/scrapy/contrib/webconsole/stats.py b/scrapy/contrib/webconsole/stats.py index 0ce81e0be..8f3ea9b82 100644 --- a/scrapy/contrib/webconsole/stats.py +++ b/scrapy/contrib/webconsole/stats.py @@ -1,10 +1,16 @@ -import pprint - from scrapy.xlib.pydispatch import dispatcher from scrapy.stats import stats from scrapy.management.web import banner, webconsole_discover_module +def stats_html_table(statsdict): + s = "" + s += "\n" + for kv in statsdict.iteritems(): + s += "\n" % kv + s += "
%s%s
\n" + return s + class StatsDump(object): webconsole_id = 'stats' webconsole_name = 'StatsCollector dump' @@ -14,9 +20,11 @@ class StatsDump(object): def webconsole_render(self, wc_request): s = banner(self) - s += "
\n"
-        s += pprint.pformat(stats)
-        s += "
\n" + s += "

Global stats

\n" + s += stats_html_table(stats.get_stats()) + for domain in stats.list_domains(): + s += "

%s

\n" % domain + s += stats_html_table(stats.get_stats(domain)) s += "\n" s += "\n" @@ -24,3 +32,4 @@ class StatsDump(object): def webconsole_discover_module(self): return self +