[Erp5-report] r9598 - in /erp5/trunk/products/ERP5Type: ZopePatch.py patches/CMFCoreUtils.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Aug 31 17:22:03 CEST 2006
Author: kevin
Date: Thu Aug 31 17:21:58 2006
New Revision: 9598
URL: http://svn.erp5.org?rev=9598&view=rev
Log:
This patch is based on Products/CMFCore/utils.py file from CMF 1.5.0 package.
Please update the following file if you update CMF to greater version.
The modifications in this method are:
* new filter on default action (= "action.getCategory().endswith('_%s' % view)" statement)
* new test on action condition (= "action.testCondition(context)" statement)
This method was patched to let CMF choose between several default actions according conditions.
Modified:
erp5/trunk/products/ERP5Type/ZopePatch.py
erp5/trunk/products/ERP5Type/patches/CMFCoreUtils.py
Modified: erp5/trunk/products/ERP5Type/ZopePatch.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/ZopePatch.py?rev=9598&r1=9597&r2=9598&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/ZopePatch.py (original)
+++ erp5/trunk/products/ERP5Type/ZopePatch.py Thu Aug 31 17:21:58 2006
@@ -41,6 +41,7 @@
from Products.ERP5Type.patches import CookieCrumbler
from Products.ERP5Type.patches import Localizer
from Products.ERP5Type.patches import CMFMailIn
+from Products.ERP5Type.patches import CMFCoreUtils
# These symbols are required for backward compatibility
from Products.ERP5Type.patches.PropertyManager import ERP5PropertyManager
Modified: erp5/trunk/products/ERP5Type/patches/CMFCoreUtils.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/patches/CMFCoreUtils.py?rev=9598&r1=9597&r2=9598&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/patches/CMFCoreUtils.py (original)
+++ erp5/trunk/products/ERP5Type/patches/CMFCoreUtils.py Thu Aug 31 17:21:58 2006
@@ -1,8 +1,34 @@
+##############################################################################
+#
+# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
+# Copyright (c) 2006 Nexedi SARL and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
from Products.CMFCore.utils import *
-from Products.CMFCore import utils
+from Products.CMFCore.utils import _verifyActionPermissions
+from Products.CMFCore import PortalContent
+
+from zLOG import LOG
+
+"""
+ This patch is based on Products/CMFCore/utils.py file from CMF 1.5.0 package.
+ Please update the following file if you update CMF to greater version.
+ The modifications in this method are:
+ * new filter on default action (= "action.getCategory().endswith('_%s' % view)" statement)
+ * new test on action condition (= "action.testCondition(context)" statement)
+ This method was patched to let CMF choose between several default actions according conditions.
+"""
security.declarePrivate('_getViewFor')
-def _getViewFor(obj, view='view'):
+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. '
'Bypass these methods by defining \'(Default)\' and \'view\' Method '
@@ -11,13 +37,12 @@
ti = obj.getTypeInfo()
if ti is not None:
-
context = getActionContext( obj )
actions = ti.listActions()
-
for action in actions:
if action.getId() == view or action.getCategory().endswith('_%s' % view):
- if _verifyActionPermissions( obj, action ):
+ if _verifyActionPermissions(obj, action):
+ if action.testCondition(context):
target = action.action(context).strip()
if target.startswith('/'):
target = target[1:]
@@ -28,6 +53,7 @@
# Find something that's allowed.
for action in actions:
if _verifyActionPermissions(obj, action):
+ if action.testCondition(context):
target = action.action(context).strip()
if target.startswith('/'):
target = target[1:]
@@ -41,4 +67,4 @@
'/'.join(obj.getPhysicalPath()))
-utils._getViewFor = _getViewFor
+PortalContent._getViewFor = CMFCoreUtils_getViewFor
More information about the Erp5-report
mailing list