Newer
Older
from plugin_dbui import Selector
"""Main Controller handling report.
"""
return 'Report section'
"""First trial
"""
tux091
committed
return "report_1"
def report_2():
"""Return the URL arguments
selector = Selector(virtdb.foo1)
# simulate a rather long processing
legac
committed
# standard response with the selected values
return dict(test=selector.as_dict(), vars=request.vars)
def report_3():
"""Return the URL arguments
"""
selector = Selector(virtdb.harvester_selector)
response.view = 'reports/report_2.html'
return dict(test=selector.as_dict())
def report_4():
"""Execute a javascript in the view using python information
"""
from plugin_dbui import Store
selector = Selector(virtdb.report4)
cfg = Store()
cfg.fields = [dict(name='controller', type='string'),
dict(name='host', type='string'),
dict(name='collections', type='string'),
dict(name='ratio', type='number')]
if selector.grouping or selector.grouping_summary:
cfg.groupField = 'controller'
cfg.data = []
for row in db().select(db.harvesters.ALL):
di = dict(controller=row.controller,
host='<a href="http://www.web2py.com">%s</a>' % row.host,
collections=row.collections,
ratio=row.ratio)
cfg['data'].append(di)
return dict(msg="Hello world",
cfg_store=json.dumps(cfg),
selector=json.dumps(selector))