[Erp5-report] r10374 - /erp5/trunk/products/ERP5Type/patches/CMFCoreUtils.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Sep 27 22:37:32 CEST 2006
Author: jp
Date: Wed Sep 27 22:37:30 2006
New Revision: 10374
URL: http://svn.erp5.org?rev=10374&view=rev
Log:
Fixed the problem of mutliple view.
Modified:
erp5/trunk/products/ERP5Type/patches/CMFCoreUtils.py
Modified: erp5/trunk/products/ERP5Type/patches/CMFCoreUtils.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/patches/CMFCoreUtils.py?rev=10374&r1=10373&r2=10374&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/patches/CMFCoreUtils.py (original)
+++ erp5/trunk/products/ERP5Type/patches/CMFCoreUtils.py Wed Sep 27 22:37:30 2006
@@ -14,6 +14,7 @@
from Products.CMFCore.utils import *
from Products.CMFCore.utils import _verifyActionPermissions
+from Products.CMFCore.Expression import getExprContext
from Products.CMFCore import PortalContent
from zLOG import LOG
@@ -27,7 +28,6 @@
This method was patched to let CMF choose between several default actions according conditions.
"""
-security.declarePrivate('_getViewFor')
def CMFCoreUtils_getViewFor(obj, view='view'):
warn('__call__() and view() methods using _getViewFor() as well as '
'_getViewFor() itself are deprecated and will be removed in CMF 1.6. '
@@ -37,12 +37,15 @@
ti = obj.getTypeInfo()
if ti is not None:
+
context = getActionContext( obj )
+ test_context = getExprContext(obj, obj) # Patch 1: mimic _listActionInfos in ActionsTool
actions = ti.listActions()
for action in actions:
if action.getId() == view or action.getCategory().endswith('_%s' % view):
+ # Patch 2: consider anything ending by _view
if _verifyActionPermissions(obj, action):
- if action.testCondition(context) and action.visible:
+ if action.visible and action.testCondition(test_context): # Patch 3: test actions
target = action.action(context).strip()
if target.startswith('/'):
target = target[1:]
@@ -53,7 +56,7 @@
# Find something that's allowed.
for action in actions:
if _verifyActionPermissions(obj, action):
- if action.testCondition(context):
+ if action.visible and action.testCondition(test_context): # Patch 3: test actions
target = action.action(context).strip()
if target.startswith('/'):
target = target[1:]
@@ -66,5 +69,4 @@
raise NotFound('Cannot find default view for "%s"' %
'/'.join(obj.getPhysicalPath()))
-
PortalContent._getViewFor = CMFCoreUtils_getViewFor
More information about the Erp5-report
mailing list