Skip to content

Commit

Permalink
Apply the default workflow in the placeful workflow policy to all add…
Browse files Browse the repository at this point in the history
…able types
  • Loading branch information
Daniel Marks committed Jun 25, 2014
1 parent deb3391 commit b6b6a52
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 11 deletions.
Expand Up @@ -5,16 +5,5 @@
<default>
<bound-workflow workflow_id="ploneintranet_workflow"/>
</default>
<type default_chain="true" type_id="Collection"/>
<type default_chain="true" type_id="Discussion Item"/>
<type default_chain="true" type_id="Document"/>
<type default_chain="true" type_id="Event"/>
<type default_chain="true" type_id="Folder"/>
<type default_chain="true" type_id="Link"/>
<type default_chain="true" type_id="News Item"/>
<type default_chain="true" type_id="TempFolder"/>
<type default_chain="true" type_id="Topic"/>
<type default_chain="true" type_id="File"/>
<type default_chain="true" type_id="Image"/>
</bindings>
</object>
12 changes: 12 additions & 0 deletions src/ploneintranet/workspace/setuphandlers.py
Expand Up @@ -44,3 +44,15 @@ def post_install(context):
# deactivate the enumerate groups interface for collective.workspace
activatePluginInterfaces(portal, 'workspace_groups',
disable=['IGroupEnumerationPlugin'])

# Set up the ploneintranet policy for all addable types
default_types = []
types = api.portal.get_tool('portal_types')
for type_info in types.listTypeInfo():
if type_info.global_allow:
default_types.append(type_info.getId())

if default_types:
pwftool = api.portal.get_tool('portal_placeful_workflow')
policy = pwftool['ploneintranet_policy']
policy.setChainForPortalTypes(default_types, ('(Default)',))
24 changes: 24 additions & 0 deletions src/ploneintranet/workspace/tests/test_setuphandlers.py
Expand Up @@ -52,3 +52,27 @@ def test_workspace_groups_hidden(self):
groupname,
[x['id'] for x in group_info],
)

def test_placeful_workflow_policy(self):
""" globally addable types should be configured to use the default
chain in the ploneintranet policy """

pwftool = api.portal.get_tool('portal_placeful_workflow')
policy = pwftool['ploneintranet_policy']
default_chain = policy.getDefaultChain(None)

default_types = [
'Collection',
'Document',
'Event',
'File',
'Folder',
'Image',
'Link',
'News Item',
]
for portal_type in default_types:
self.assertEqual(
default_chain,
policy.getChainFor(portal_type)
)

0 comments on commit b6b6a52

Please sign in to comment.