Commit 3b8cf3e4 authored by Romain Courteaud's avatar Romain Courteaud

Raise error when something is wrong.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15195 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 11559e07
...@@ -1198,24 +1198,19 @@ class BasicStructure: ...@@ -1198,24 +1198,19 @@ class BasicStructure:
# each report line is a tuple of the form : # each report line is a tuple of the form :
#(selection_id, is_summary, depth, object_list, object_list_size, is_open) #(selection_id, is_summary, depth, object_list, object_list_size, is_open)
try: default_selection_report_path = self.report_root_list[0][0].split('/', 1)[0]
default_selection_report_path = self.report_root_list[0][0].split('/')[0] if (portal_categories is None or \
except (IndexError): portal_categories._getOb(default_selection_report_path, None) is None) \
message = 'report path is empty or not valid, please check selection\ and (portal_domains is None or \
report path in Planning properties' portal_domains._getOb(default_selection_report_path, None) is None):
return [(Message(domain='erp5_ui', message=message,mapping=None))] default_selection_report_path = self.report_root_list[0][0]
if (default_selection_report_path in portal_categories.objectIds()) or \
(portal_domains is not None and default_selection_report_path in \
portal_domains.objectIds()):
pass
else:
default_selection_root_path = self.report_root_list[0][0]
self.selection_report_path = self.selection.getReportPath(default = \
(default_selection_report_path,))
if self.selection_report_path in (None,()): self.selection_report_path = self.selection.getReportPath(
message = 'report path is empty or not valid' default=default_selection_report_path)
return [(Message(domain='erp5_ui', message=message,mapping=None))]
if self.selection_report_path in (None, ()):
raise PlanningBoxError, 'report path is empty or not valid on %s' % \
self.field.absolute_url()
# testing report_depth value # testing report_depth value
if report_depth is not None: if report_depth is not None:
...@@ -1237,6 +1232,10 @@ class BasicStructure: ...@@ -1237,6 +1232,10 @@ class BasicStructure:
is_report_opened=is_report_opened, is_report_opened=is_report_opened,
sort_on=self.selection.sort_on, sort_on=self.selection.sort_on,
form_id=self.form.id) form_id=self.form.id)
if report_tree_list == []:
raise PlanningBoxError, "Report tree list is empty on %s" % \
self.field.absolute_url()
################################################## ##################################################
########### BUILDING REPORT_GROUPS ############### ########### BUILDING REPORT_GROUPS ###############
...@@ -1311,11 +1310,8 @@ class BasicStructure: ...@@ -1311,11 +1310,8 @@ class BasicStructure:
context=self.context, REQUEST=self.REQUEST) context=self.context, REQUEST=self.REQUEST)
else: else:
# no list_method found # no list_method found
# XXX seems to be buggy : raise PlanningBoxError, "No list method found on %s" % \
#object_list = self.here.portal_selections.getSelectionValueList( self.field.absolute_url()
# self.selection_name, context=self.here, REQUEST=self.REQUEST)
message = 'No list method found, please check planningBox properties'
return [(Message(domain='erp5_ui', message=message,mapping=None))]
# recovering exeption_uid_list # recovering exeption_uid_list
exception_uid_list = object_tree_line.getExceptionUidList() exception_uid_list = object_tree_line.getExceptionUidList()
...@@ -1416,12 +1412,11 @@ class BasicStructure: ...@@ -1416,12 +1412,11 @@ class BasicStructure:
self.report_groups=self.report_groups[self.main_axis_info['bound_start']: self.report_groups=self.report_groups[self.main_axis_info['bound_start']:
self.main_axis_info['bound_stop']] self.main_axis_info['bound_stop']]
else: else:
# ERROR : self.report_groups = []
# no group is available so the Y and X axis will be empty... # no group is available so the Y and X axis will be empty...
message= 'selection method returned empty list of objects : please check\ raise PlanningBoxError, \
your list_method and report_root' 'selection method returned empty list of objects : please check' \
return [(Message(domain='erp5_ui', message=message,mapping=None))] 'list_method and report_root of %s' % \
self.field.absolute_url()
################################################## ##################################################
############ GETTING SEC AXIS BOUNDS ############# ############ GETTING SEC AXIS BOUNDS #############
......
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