Commit e6a169ea authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Detect JSON error in grid controller.

parent 6ef255e2
...@@ -64,20 +64,24 @@ def grid(): ...@@ -64,20 +64,24 @@ def grid():
selector = MySelector(ui_table) selector = MySelector(ui_table)
# extract the report configuration and the build the report # extract the report configuration and the build the report
if "id_lists" in request.vars: try:
config = db.lists[request.vars.id_lists] if "id_lists" in request.vars:
report = List(config, selector) config = db.lists[request.vars.id_lists]
report = List(config, selector)
elif "id_metrics1d" in request.vars:
config = db.metrics1d[request.vars.id_metrics1d] elif "id_metrics1d" in request.vars:
report = Metric1D(config, selector) config = db.metrics1d[request.vars.id_metrics1d]
report = Metric1D(config, selector)
elif "id_metrics2d" in request.vars:
config = db.metrics2d[request.vars.id_metrics2d] elif "id_metrics2d" in request.vars:
report = Metric2D(config, selector) config = db.metrics2d[request.vars.id_metrics2d]
report = Metric2D(config, selector)
else:
return INLINE_ALERT % ("Error", "Report id is not defined.") else:
return INLINE_ALERT % ("Error", "Report id is not defined.")
except ValueError, msg:
return INLINE_ALERT % ("JSON Error...", msg)
# extract the configurations for the Ext.data.Store and App.grid.Panel. # extract the configurations for the Ext.data.Store and App.grid.Panel.
store = report.to_store() store = report.to_store()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment