comparison MoinMoin/stats/hitcounts.py @ 68:0bbc39b09f95

optimize backup by sorting, refactor some easy stuff to use redirectedOutput imported from: moin--main--1.5--patch-70
author Thomas Waldmann <tw@waldmann-edv.de>
date Mon, 03 Oct 2005 08:41:37 +0000
parents 55ff4feb0f59
children a54cebaab73e
comparison
equal deleted inserted replaced
67:24ec4c3430cf 68:0bbc39b09f95
134 134
135 135
136 def text(pagename, request, params=''): 136 def text(pagename, request, params=''):
137 from MoinMoin.util.dataset import TupleDataset, Column 137 from MoinMoin.util.dataset import TupleDataset, Column
138 from MoinMoin.widget.browser import DataBrowserWidget 138 from MoinMoin.widget.browser import DataBrowserWidget
139 from cStringIO import StringIO
140 _ = request.getText 139 _ = request.getText
141 140
142 # check params 141 # check params
143 filterpage = None 142 filterpage = None
144 if params.startswith('page='): 143 if params.startswith('page='):
180 hits.addRow((d, "%.1f" % (sv/sd), "%.1f" % (se/sd))) 179 hits.addRow((d, "%.1f" % (sv/sd), "%.1f" % (se/sd)))
181 sv = 0.0 180 sv = 0.0
182 se = 0.0 181 se = 0.0
183 sd = 0.0 182 sd = 0.0
184 183
185 buffer = StringIO()
186 request.redirect(buffer)
187 table = DataBrowserWidget(request) 184 table = DataBrowserWidget(request)
188 table.setData(hits) 185 table.setData(hits)
189 table.render() 186 return table.toHTML()
190 request.redirect()
191
192 return buffer.getvalue()
193 187
194 188
195 def draw(pagename, request): 189 def draw(pagename, request):
196 import shutil, cStringIO 190 import shutil, cStringIO
197 from MoinMoin.stats.chart import Chart, ChartData, Color 191 from MoinMoin.stats.chart import Chart, ChartData, Color