[CMF-checkins] CVS: CMF/CMFCore - ActionsTool.py:1.31.2.4

Florent Guillaume fg@nuxeo.com
Sun, 4 Aug 2002 13:15:16 -0400


Update of /cvs-repository/CMF/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv9519

Modified Files:
      Tag: chrism-actions-branch
	ActionsTool.py 
Log Message:

Reintroduced the test of categories using a prefix.


=== CMF/CMFCore/ActionsTool.py 1.31.2.3 => 1.31.2.4 ===
         category = action.get('category', 'object')
         permissions = action.get('permissions', None)
         # context will be one of object, folder, or portal
-        context = ((category in ('object', 'workflow') and object) or
-                   (category == 'folder' and folder)) or portal
+        if (object is not None and
+            (category.startswith('object') or
+             category.startswith('workflow'))):
+            context = object
+        elif (folder is not None and
+              category.startswith('folder')):
+            context = folder
+        else:
+            context = portal
         if permissions and not checkPermissions(permissions, context):
             # inadequate permissions to see the action
             return None, None