Commit 4271f636 authored by Nicolas Delaby's avatar Nicolas Delaby

Fix issue when Priority was ignored on actions if user wants to override

the default action.
Reviewed by Jerome


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32357 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9e4f632d
...@@ -490,23 +490,22 @@ class ERP5TypeInformation(XMLObject, ...@@ -490,23 +490,22 @@ class ERP5TypeInformation(XMLObject,
"""Return the object that renders the default view for the given object """Return the object that renders the default view for the given object
""" """
ec = createExpressionContext(ob) ec = createExpressionContext(ob)
best_action = (), None best_action = None
for action in self.getActionList(): for action in self.getActionList():
if action['id'] == view: if action['id'] == view and action.test(ec):
if action.test(ec): best_action = action
break break
else: else:
# In case that "view" (or "list") action is not present or not allowed, # In case that "view" (or "list") action is not present or not allowed,
# find something that's allowed (of the same category, if possible). # find something that's allowed (of the same category, if possible).
index = action['category'].endswith('_' + view), same_category = action['category'].endswith('_' + view)
if best_action[0] < index and action.test(ec): if same_category and action.test(ec):
best_action = index, action best_action = action
break
else: else:
action = best_action[1]
if action is None:
raise AccessControl_Unauthorized( raise AccessControl_Unauthorized(
'No accessible views available for %r' % ob.getPath()) 'No accessible views available for %r' % ob.getPath())
action = best_action
target = action.cook(ec)['url'].strip().split(ec.vars['object_url'])[-1] target = action.cook(ec)['url'].strip().split(ec.vars['object_url'])[-1]
if target.startswith('/'): if target.startswith('/'):
target = target[1:] target = target[1:]
......
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