[Erp5-report] r32357 nicolas - /erp5/trunk/products/ERP5Type/ERP5Type.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Feb 9 14:32:02 CET 2010


Author: nicolas
Date: Tue Feb  9 14:32:01 2010
New Revision: 32357

URL: http://svn.erp5.org?rev=32357&view=rev
Log:
Fix issue when Priority was ignored on actions if user wants to override
the default action.
Reviewed by Jerome

Modified:
    erp5/trunk/products/ERP5Type/ERP5Type.py

Modified: erp5/trunk/products/ERP5Type/ERP5Type.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/ERP5Type.py?rev=32357&r1=32356&r2=32357&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/ERP5Type.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/ERP5Type.py [utf8] Tue Feb  9 14:32:01 2010
@@ -490,23 +490,22 @@
       """Return the object that renders the default view for the given object
       """
       ec = createExpressionContext(ob)
-      best_action = (), None
+      best_action = None
       for action in self.getActionList():
-        if action['id'] == view:
-          if action.test(ec):
-            break
+        if action['id'] == view and action.test(ec):
+          best_action = action
+          break
         else:
           # In case that "view" (or "list") action is not present or not allowed,
           # find something that's allowed (of the same category, if possible).
-          index = action['category'].endswith('_' + view),
-          if best_action[0] < index and action.test(ec):
-            best_action = index, action
+          same_category = action['category'].endswith('_' + view)
+          if same_category and action.test(ec):
+            best_action = action
+            break
       else:
-        action = best_action[1]
-        if action is None:
-          raise AccessControl_Unauthorized(
-            'No accessible views available for %r' % ob.getPath())
-
+        raise AccessControl_Unauthorized(
+          'No accessible views available for %r' % ob.getPath())
+      action = best_action
       target = action.cook(ec)['url'].strip().split(ec.vars['object_url'])[-1]
       if target.startswith('/'):
           target = target[1:]




More information about the Erp5-report mailing list