[CMF-checkins] SVN: CMF/branches/1.5/C - CMFSetup.workflow: Workflows managing no permissions at all could

Jens Vagelpohl jens at dataflake.org
Fri Jan 27 18:47:53 EST 2006


Log message for revision 41471:
  - CMFSetup.workflow: Workflows managing no permissions at all could
    make the CMFSetup workflow exporter fail.
    (http://www.zope.org/Collectors/CMF/397) 
  

Changed:
  U   CMF/branches/1.5/CHANGES.txt
  U   CMF/branches/1.5/CMFSetup/tests/test_workflow.py
  U   CMF/branches/1.5/CMFSetup/workflow.py

-=-
Modified: CMF/branches/1.5/CHANGES.txt
===================================================================
--- CMF/branches/1.5/CHANGES.txt	2006-01-27 23:31:30 UTC (rev 41470)
+++ CMF/branches/1.5/CHANGES.txt	2006-01-27 23:47:53 UTC (rev 41471)
@@ -2,6 +2,10 @@
 
   Bug Fixes
 
+    - CMFSetup.workflow: Workflows managing no permissions at all could
+      make the CMFSetup workflow exporter fail.
+      (http://www.zope.org/Collectors/CMF/397)
+
     - CMFDefault.DiscussionItem: Deleting a discussion reply would not
       recurse and left items below the deleted reply still cataloged
       (http://www.zope.org/Collectors/CMF/391)

Modified: CMF/branches/1.5/CMFSetup/tests/test_workflow.py
===================================================================
--- CMF/branches/1.5/CMFSetup/tests/test_workflow.py	2006-01-27 23:31:30 UTC (rev 41470)
+++ CMF/branches/1.5/CMFSetup/tests/test_workflow.py	2006-01-27 23:47:53 UTC (rev 41471)
@@ -154,7 +154,7 @@
                                , transitions=v[ 2 ]
                                )
             if not v[ 3 ]:
-                state.permission_roles = {}
+                state.permission_roles = None
 
             for permission, roles in v[ 3 ].items():
                 state.setPermission( permission

Modified: CMF/branches/1.5/CMFSetup/workflow.py
===================================================================
--- CMF/branches/1.5/CMFSetup/workflow.py	2006-01-27 23:31:30 UTC (rev 41470)
+++ CMF/branches/1.5/CMFSetup/workflow.py	2006-01-27 23:47:53 UTC (rev 41471)
@@ -616,16 +616,18 @@
           'acquired' -- whether roles are acquired for the permission
         """
         result = []
+        perm_roles = state.permission_roles
 
-        items = state.permission_roles.items()
-        items.sort()
+        if perm_roles:
+            items = state.permission_roles.items()
+            items.sort()
 
-        for k, v in items:
+            for k, v in items:
 
-            result.append( { 'name' : k
-                           , 'roles' : v
-                           , 'acquired' : not isinstance( v, tuple )
-                           } )
+                result.append( { 'name' : k
+                               , 'roles' : v
+                               , 'acquired' : not isinstance( v, tuple )
+                               } )
 
         return result
 



More information about the CMF-checkins mailing list