Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Products.DCWorkflow
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Products.DCWorkflow
Commits
24018004
Commit
24018004
authored
Oct 14, 2013
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- fixed Chameleon compatibility
parent
cb7bb7c0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
220 additions
and
241 deletions
+220
-241
Products/DCWorkflow/exportimport.py
Products/DCWorkflow/exportimport.py
+5
-5
Products/DCWorkflow/tests/test_exportimport.py
Products/DCWorkflow/tests/test_exportimport.py
+4
-4
Products/DCWorkflow/xml/wtcWorkflowExport.xml
Products/DCWorkflow/xml/wtcWorkflowExport.xml
+211
-232
No files found.
Products/DCWorkflow/exportimport.py
View file @
24018004
...
@@ -226,7 +226,7 @@ class WorkflowDefinitionConfigurator(Implicit):
...
@@ -226,7 +226,7 @@ class WorkflowDefinitionConfigurator(Implicit):
'script_info' -- a list of mappings describing the scripts which
'script_info' -- a list of mappings describing the scripts which
provide added business logic (see '_extractScripts').
provide added business logic (see '_extractScripts').
"""
"""
workflow_info
[
'manager_bypass'
]
=
bool
(
workflow
.
manager_bypass
)
workflow_info
[
'manager_bypass'
]
=
str
(
bool
(
workflow
.
manager_bypass
)
)
workflow_info
[
'creation_guard'
]
=
self
.
_extractCreationGuard
(
workflow
)
workflow_info
[
'creation_guard'
]
=
self
.
_extractCreationGuard
(
workflow
)
workflow_info
[
'state_variable'
]
=
workflow
.
state_var
workflow_info
[
'state_variable'
]
=
workflow
.
state_var
workflow_info
[
'initial_state'
]
=
workflow
.
initial_state
workflow_info
[
'initial_state'
]
=
workflow
.
initial_state
...
@@ -294,9 +294,9 @@ class WorkflowDefinitionConfigurator(Implicit):
...
@@ -294,9 +294,9 @@ class WorkflowDefinitionConfigurator(Implicit):
info
=
{
'id'
:
k
,
info
=
{
'id'
:
k
,
'description'
:
v
.
description
,
'description'
:
v
.
description
,
'for_catalog'
:
bool
(
v
.
for_catalog
),
'for_catalog'
:
str
(
bool
(
v
.
for_catalog
)
),
'for_status'
:
bool
(
v
.
for_status
),
'for_status'
:
str
(
bool
(
v
.
for_status
)
),
'update_always'
:
bool
(
v
.
update_always
),
'update_always'
:
str
(
bool
(
v
.
update_always
)
),
'default_value'
:
v
.
default_value
,
'default_value'
:
v
.
default_value
,
'default_type'
:
default_type
,
'default_type'
:
default_type
,
'default_expr'
:
v
.
getDefaultExprText
(),
'default_expr'
:
v
.
getDefaultExprText
(),
...
@@ -406,7 +406,7 @@ class WorkflowDefinitionConfigurator(Implicit):
...
@@ -406,7 +406,7 @@ class WorkflowDefinitionConfigurator(Implicit):
for
k
,
v
in
items
:
for
k
,
v
in
items
:
result
.
append
({
'name'
:
k
,
result
.
append
({
'name'
:
k
,
'roles'
:
v
,
'roles'
:
v
,
'acquired'
:
not
isinstance
(
v
,
tuple
)})
'acquired'
:
str
(
not
isinstance
(
v
,
tuple
)
)})
return
result
return
result
...
...
Products/DCWorkflow/tests/test_exportimport.py
View file @
24018004
...
@@ -251,9 +251,9 @@ class WorkflowDefinitionConfiguratorTests(_WorkflowSetup, _GuardChecker):
...
@@ -251,9 +251,9 @@ class WorkflowDefinitionConfiguratorTests(_WorkflowSetup, _GuardChecker):
self
.
assertEqual
(
info
[
'description'
],
expected
[
0
])
self
.
assertEqual
(
info
[
'description'
],
expected
[
0
])
self
.
assertEqual
(
info
[
'default_value'
],
expected
[
1
])
self
.
assertEqual
(
info
[
'default_value'
],
expected
[
1
])
self
.
assertEqual
(
info
[
'default_expr'
],
expected
[
2
])
self
.
assertEqual
(
info
[
'default_expr'
],
expected
[
2
])
self
.
assertEqual
(
info
[
'for_catalog'
],
expected
[
3
]
)
self
.
assertEqual
(
info
[
'for_catalog'
],
str
(
expected
[
3
])
)
self
.
assertEqual
(
info
[
'for_status'
],
expected
[
4
]
)
self
.
assertEqual
(
info
[
'for_status'
],
str
(
expected
[
4
])
)
self
.
assertEqual
(
info
[
'update_always'
],
expected
[
5
]
)
self
.
assertEqual
(
info
[
'update_always'
],
str
(
expected
[
5
])
)
self
.
_assertGuard
(
info
,
*
expected
[
-
4
:])
self
.
_assertGuard
(
info
,
*
expected
[
-
4
:])
...
@@ -297,7 +297,7 @@ class WorkflowDefinitionConfiguratorTests(_WorkflowSetup, _GuardChecker):
...
@@ -297,7 +297,7 @@ class WorkflowDefinitionConfiguratorTests(_WorkflowSetup, _GuardChecker):
fp
=
[
x
for
x
in
permissions
if
x
[
'name'
]
==
ep_id
][
0
]
fp
=
[
x
for
x
in
permissions
if
x
[
'name'
]
==
ep_id
][
0
]
self
.
assertEqual
(
fp
[
'acquired'
],
self
.
assertEqual
(
fp
[
'acquired'
],
not
isinstance
(
ep_roles
,
tuple
))
str
(
not
isinstance
(
ep_roles
,
tuple
)
))
self
.
assertEqual
(
len
(
fp
[
'roles'
]),
len
(
ep_roles
))
self
.
assertEqual
(
len
(
fp
[
'roles'
]),
len
(
ep_roles
))
...
...
Products/DCWorkflow/xml/wtcWorkflowExport.xml
View file @
24018004
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<dc-workflow
<dc-workflow
xmlns:tal=
"http://xml.zope.org/namespaces/tal"
xmlns:tal=
"http://xml.zope.org/namespaces/tal"
workflow_id=
"dcworkflow"
workflow_id=
"dcworkflow"
title=
"Some DCWorkflow"
title=
"Some DCWorkflow"
description=
"Some Description"
description=
"Some Description"
state_variable=
"review_state"
state_variable=
"review_state"
initial_state=
"visible"
initial_state=
"visible"
tal:define=
"info python: context.getWorkflowInfo(options['workflow_id'])"
tal:define=
"info python: here.getWorkflowInfo(
tal:attributes=
"workflow_id info/id;
options[ 'workflow_id' ] )"
title info/title;
tal:attributes=
"workflow_id info/id;
description info/description;
title info/title;
manager_bypass info/manager_bypass;
description info/description;
state_variable info/state_variable;
manager_bypass info/manager_bypass;
initial_state info/initial_state"
><tal:case
state_variable info/state_variable;
tal:condition=
"info/creation_guard"
>
initial_state info/initial_state"
<instance-creation-conditions
><tal:case
tal:condition=
"info/creation_guard"
>
tal:define=
"creation_guard info/creation_guard"
>
<instance-creation-conditions
tal:define=
"creation_guard info/creation_guard"
>
<guard><tal:case
<guard
tal:condition=
"creation_guard/guard_permissions"
>
><tal:case
tal:condition=
"creation_guard/guard_permissions"
>
<guard-permission
<guard-permission
tal:repeat=
"permission creation_guard/guard_permissions"
tal:repeat=
"permission creation_guard/guard_permissions"
tal:content=
"permission"
>
PERMISSION
</guard-permission></tal:case><tal:case
tal:content=
"permission"
>
PERMISSION
</guard-permission></tal:case
tal:condition=
"creation_guard/guard_roles"
>
><tal:case
tal:condition=
"creation_guard/guard_roles"
>
<guard-role
<guard-role
tal:repeat=
"role creation_guard/guard_roles"
tal:repeat=
"role creation_guard/guard_roles"
tal:content=
"role"
>
ROLE
</guard-role></tal:case><tal:case
tal:content=
"role"
>
ROLE
</guard-role></tal:case
tal:condition=
"creation_guard/guard_groups"
>
><tal:case
tal:condition=
"creation_guard/guard_groups"
>
<guard-group
<guard-group
tal:repeat=
"group creation_guard/guard_groups"
tal:repeat=
"group creation_guard/guard_groups"
tal:content=
"group"
>
GROUP
</guard-group></tal:case><tal:case
tal:content=
"group"
>
GROUP
</guard-group></tal:case
tal:condition=
"creation_guard/guard_expr"
>
><tal:case
tal:condition=
"creation_guard/guard_expr"
>
<guard-expression
<guard-expression
tal:content=
"creation_guard/guard_expr"
>
EXPR
</guard-expression></tal:case>
tal:content=
"creation_guard/guard_expr"
>
EXPRESSION
</guard-expression
></tal:case>
</guard>
</guard>
</instance-creation-conditions></tal:case>
</instance-creation-conditions></tal:case><tal:case
<permission
tal:condition=
"info/permissions"
>
tal:repeat=
"permission info/permissions"
<permission
tal:content=
"permission"
>
PERMISSION
</permission>
tal:repeat=
"permission info/permissions"
<state
tal:content=
"permission"
>
PERMISSION
</permission></tal:case><tal:case
state_id=
"pending"
tal:condition=
"info/state_info"
>
title=
"Waiting for reviewer"
<state
state_id=
"pending"
tal:repeat=
"state info/state_info"
title=
"Waiting for reviewer"
tal:attributes=
"state_id state/id;
tal:repeat=
"state info/state_info"
title state/title;
tal:attributes=
"state_id state/id;
"
title state/title"
><tal:case
><tal:case
tal:condition=
"state/description"
>
tal:condition=
"state/description"
>
<description
<description
tal:content=
"state/description"
>
DESCRIPTION
</description></tal:case>
tal:content=
"state/description"
>
DESCRIPTION
</description></tal:case><tal:case
<exit-transition
tal:condition=
"state/transitions"
>
transition_id=
"TRANSITION_ID"
<exit-transition
transition_id=
"TRANSITION_ID"
tal:repeat=
"exit state/transitions"
tal:repeat=
"exit state/transitions"
tal:attributes=
"transition_id exit"
tal:attributes=
"transition_id exit"
/></tal:case><tal:case
/>
tal:condition=
"state/permissions"
>
<permission-map
<permission-map
name=
""
name=
""
acquired=
"True"
acquired=
"True"
tal:repeat=
"perm state/permissions"
tal:repeat=
"perm state/permissions"
tal:attributes=
"name perm/name;
tal:attributes=
"name perm/name;
acquired perm/acquired"
><tal:case
acquired perm/acquired;
tal:condition=
"perm/roles"
>
"
>
<permission-role
<permission-role
tal:repeat=
"role perm/roles"
tal:repeat=
"role perm/roles"
tal:content=
"role"
>
ROLE
</permission-role></tal:case>
tal:content=
"role"
>
ROLE
</permission-role>
</permission-map></tal:case><tal:case
</permission-map>
tal:condition=
"state/groups"
>
<group-map
<group-map
name=
""
name=
""
tal:repeat=
"group state/groups"
tal:repeat=
"group state/groups"
tal:attributes=
"name python: group[0]"
>
tal:attributes=
"name python: group[ 0 ];
<group-role
"
>
tal:repeat=
"role python: group[1]"
<group-role
tal:content=
"role"
>
ROLE
</group-role>
tal:repeat=
"role python: group[ 1 ]"
</group-map></tal:case><tal:case
tal:content=
"role"
>
ROLE
</group-role>
tal:condition=
"state/variables"
>
</group-map>
<assignment
name=
"VAR_NAME"
<assignment
type=
"VAR_TYPE"
name=
"VAR_NAME"
tal:repeat=
"var state/variables"
type=
"VAR_TYPE"
tal:attributes=
"name var/name;
tal:repeat=
"var state/variables"
type var/type"
tal:attributes=
"name var/name;
tal:content=
"var/value"
>
VALUE
</assignment></tal:case>
type var/type;
</state></tal:case><tal:case
"
tal:condition=
"info/transition_info"
>
tal:content=
"var/value"
>
VALUE
</assignment>
<transition
transition_id=
"Publish"
</state>
title=
"Reviewer publishes content"
<transition
new_state=
"published"
transition_id=
"Publish"
trigger=
"USER"
title=
"Reviewer publishes content"
before_script=
""
new_state=
"published"
after_script=
""
trigger=
"USER"
tal:repeat=
"transition info/transition_info"
before_script=
""
tal:attributes=
"transition_id transition/id;
after_script=
""
title transition/title;
tal:repeat=
"transition info/transition_info"
new_state transition/new_state_id;
tal:attributes=
"transition_id transition/id;
trigger transition/trigger_type;
title transition/title;
before_script transition/script_name;
new_state transition/new_state_id;
after_script transition/after_script_name"
><tal:case
trigger transition/trigger_type;
tal:condition=
"transition/description"
>
before_script transition/script_name;
<description
after_script transition/after_script_name;
tal:content=
"transition/description"
>
DESCRIPTION
</description></tal:case>
"
<action
url=
"URL"
><tal:case
tal:condition=
"transition/description"
>
category=
"CATEGORY"
<description
tal:condition=
"transition/actbox_name"
tal:content=
"transition/description"
>
DESCRIPTION
</description></tal:case>
tal:attributes=
"url transition/actbox_url;
<action
icon transition/actbox_icon;
url=
"URL"
category transition/actbox_category"
category=
"CATEGORY"
tal:content=
"transition/actbox_name"
>
ACTION NAME
</action>
tal:condition=
"transition/actbox_name"
<guard><tal:case
tal:attributes=
"url transition/actbox_url;
tal:condition=
"transition/guard_permissions"
>
icon transition/actbox_icon;
<guard-permission
category transition/actbox_category;
tal:repeat=
"permission transition/guard_permissions"
"
tal:content=
"permission"
>
PERMISSION
</guard-permission></tal:case><tal:case
tal:content=
"transition/actbox_name"
>
ACTION NAME
</action>
tal:condition=
"transition/guard_roles"
>
<guard
<guard-role
><tal:case
tal:condition=
"transition/guard_permissions"
>
tal:repeat=
"role transition/guard_roles"
<guard-permission
tal:content=
"role"
>
ROLE
</guard-role></tal:case><tal:case
tal:repeat=
"permission transition/guard_permissions"
tal:condition=
"transition/guard_groups"
>
tal:content=
"permission"
>
PERMISSION
</guard-permission></tal:case
<guard-group
><tal:case
tal:condition=
"transition/guard_roles"
>
tal:repeat=
"group transition/guard_groups"
<guard-role
tal:content=
"group"
>
GROUP
</guard-group></tal:case><tal:case
tal:repeat=
"role transition/guard_roles"
tal:condition=
"transition/guard_expr"
>
tal:content=
"role"
>
ROLE
</guard-role></tal:case
<guard-expression
><tal:case
tal:condition=
"transition/guard_groups"
>
tal:content=
"transition/guard_expr"
>
EXPRESSION
</guard-expression></tal:case>
<guard-group
</guard><tal:case
tal:repeat=
"group transition/guard_groups"
tal:condition=
"transition/variables"
>
tal:content=
"group"
>
GROUP
</guard-group></tal:case
<assignment
name=
"VAR_NAME"
><tal:case
tal:condition=
"transition/guard_expr"
>
tal:repeat=
"var transition/variables"
<guard-expression
tal:attributes=
"name var/name"
tal:content=
"transition/guard_expr"
>
EXPRESSION
</guard-expression
tal:content=
"var/expr"
>
EXPRESSION
</assignment></tal:case>
></tal:case>
</transition></tal:case><tal:case
tal:condition=
"info/worklist_info"
>
<worklist
worklist_id=
"reviewer_queue"
title=
"For Review"
tal:repeat=
"worklist info/worklist_info"
tal:attributes=
"worklist_id worklist/id;
title worklist/title"
><tal:case
tal:condition=
"worklist/description"
>
<description
tal:content=
"worklist/description"
>
DESCRIPTION
</description></tal:case>
<action
url=
"URL"
category=
"CATEGORY"
tal:condition=
"worklist/actbox_name"
tal:attributes=
"url worklist/actbox_url;
category worklist/actbox_category;
icon worklist/actbox_icon"
tal:content=
"worklist/actbox_name"
>
ACTION NAME
</action>
<guard><tal:case
tal:condition=
"worklist/guard_permissions"
>
<guard-permission
tal:repeat=
"permission worklist/guard_permissions"
tal:content=
"permission"
>
PERMISSION
</guard-permission></tal:case><tal:case
tal:condition=
"worklist/guard_roles"
>
<guard-role
tal:repeat=
"role worklist/guard_roles"
tal:content=
"role"
>
ROLE
</guard-role></tal:case><tal:case
tal:condition=
"worklist/guard_groups"
>
<guard-group
tal:repeat=
"group worklist/guard_groups"
tal:content=
"group"
>
GROUP
</guard-group></tal:case><tal:case
tal:condition=
"worklist/guard_expr"
>
<guard-expression
tal:content=
"worklist/guard_expr"
>
EXPRESSION
</guard-expression></tal:case>
</guard>
</guard>
<assignment
<match
name=
"review_state"
name=
"VAR_NAME"
values=
"pending"
tal:repeat=
"var transition/variables"
tal:repeat=
"match worklist/var_match"
tal:attributes=
"name var/name"
tal:attributes=
"name python: match[0];
tal:content=
"var/expr"
>
EXPRESSION
</assignment>
values python: match[1]"
/>
</transition>
</worklist></tal:case><tal:case
<worklist
tal:condition=
"info/variable_info"
>
worklist_id=
"reviewer_queue"
<variable
variable_id=
"action"
title=
"For Review"
for_catalog=
"True"
tal:repeat=
"worklist info/worklist_info"
for_status=
"True"
tal:attributes=
"worklist_id worklist/id;
update_always=
"True"
title worklist/title;
tal:repeat=
"variable info/variable_info"
"
tal:attributes=
"variable_id variable/id;
><tal:case
tal:condition=
"worklist/description"
>
for_catalog variable/for_catalog;
<description
for_status variable/for_status;
tal:content=
"worklist/description"
>
DESCRIPTION
</description></tal:case>
update_always variable/update_always"
><tal:case
<action
tal:condition=
"variable/description"
>
url=
"URL"
<description
category=
"CATEGORY"
tal:content=
"variable/description"
>
DESCRIPTION
</description></tal:case>
tal:condition=
"worklist/actbox_name"
tal:attributes=
"url worklist/actbox_url;
category worklist/actbox_category;
icon worklist/actbox_icon;
"
tal:content=
"worklist/actbox_name"
>
ACTION NAME
</action>
<guard
><tal:case
tal:condition=
"worklist/guard_permissions"
>
<guard-permission
tal:repeat=
"permission worklist/guard_permissions"
tal:content=
"permission"
>
PERMISSION
</guard-permission></tal:case
><tal:case
tal:condition=
"worklist/guard_roles"
>
<guard-role
tal:repeat=
"role worklist/guard_roles"
tal:content=
"role"
>
ROLE
</guard-role></tal:case
><tal:case
tal:condition=
"worklist/guard_groups"
>
<guard-group
tal:repeat=
"group worklist/guard_groups"
tal:content=
"group"
>
GROUP
</guard-group></tal:case
><tal:case
tal:condition=
"worklist/guard_expr"
>
<guard-expression
tal:content=
"worklist/guard_expr"
>
EXPRESSION
</guard-expression
></tal:case>
</guard>
<match
name=
"review_state"
values=
"pending"
tal:repeat=
"match worklist/var_match"
tal:attributes=
"name python: match[ 0 ];
values python: match[ 1 ];
"
/>
</worklist>
<variable
variable_id=
"action"
for_catalog=
"True"
for_status=
"True"
update_always=
"True"
tal:repeat=
"variable info/variable_info"
tal:attributes=
"variable_id variable/id;
for_catalog variable/for_catalog;
for_status variable/for_status;
update_always variable/update_always;
"
><tal:case
tal:condition=
"variable/description"
>
<description
tal:content=
"variable/description"
>
DESCRIPTION
</description></tal:case>
<default>
<default>
<value
<value
type=
"VAR_TYPE"
type=
"VAR_TYPE"
tal:attributes=
"type variable/default_type"
tal:attributes=
"type variable/default_type"
tal:condition=
"variable/default_value"
tal:condition=
"variable/default_value"
tal:content=
"variable/default_value"
>
VALUE
</value>
tal:content=
"variable/default_value"
>
VALUE
</value>
<expression
<expression
tal:condition=
"variable/default_expr"
tal:condition=
"variable/default_expr"
tal:content=
"variable/default_expr"
>
EXPRESSION
</expression>
tal:content=
"variable/default_expr"
>
EXPRESSION
</expression>
</default>
</default>
<guard
<guard><tal:case
><tal:case
tal:condition=
"variable/guard_permissions"
>
tal:condition=
"variable/guard_permissions"
>
<guard-permission
<guard-permission
tal:repeat=
"permission variable/guard_permissions"
tal:repeat=
"permission variable/guard_permissions"
tal:content=
"permission"
>
PERMISSION
</guard-permission></tal:case
tal:content=
"permission"
>
PERMISSION
</guard-permission></tal:case><tal:case
><tal:case
tal:condition=
"variable/guard_roles"
>
tal:condition=
"variable/guard_roles"
>
<guard-role
<guard-role
tal:repeat=
"role variable/guard_roles"
tal:repeat=
"role variable/guard_roles"
tal:content=
"role"
>
ROLE
</guard-role></tal:case
tal:content=
"role"
>
ROLE
</guard-role></tal:case><tal:case
><tal:case
tal:condition=
"variable/guard_groups"
>
tal:condition=
"variable/guard_groups"
>
<guard-group
<guard-group
tal:repeat=
"group variable/guard_groups"
tal:repeat=
"group variable/guard_groups"
tal:content=
"group"
>
GROUP
</guard-group></tal:case
tal:content=
"group"
>
GROUP
</guard-group></tal:case><tal:case
><tal:case
tal:condition=
"variable/guard_expr"
>
tal:condition=
"variable/guard_expr"
>
<guard-expression
<guard-expression
tal:content=
"variable/guard_expr"
>
EXPRESSION
</guard-expression
tal:content=
"variable/guard_expr"
>
EXPRESSION
</guard-expression></tal:case>
></tal:case>
</guard>
</guard>
</variable>
</variable></tal:case><tal:case
<script
tal:condition=
"info/script_info"
>
script_id=
"SCRIPT_ID"
<script
script_id=
"SCRIPT_ID"
type=
"Script (Python)"
type=
"Script (Python)"
filename=
"/path/to/SCRIPT_ID.py"
filename=
"/path/to/SCRIPT_ID.py"
module=
""
module=
""
function=
""
function=
""
tal:repeat=
"script info/script_info"
tal:repeat=
"script info/script_info"
tal:attributes=
"script_id script/id;
tal:attributes=
"script_id script/id;
type script/meta_type;
type script/meta_type;
filename script/filename;
filename script/filename;
module script/module;
module script/module;
function script/function
function script/function"
/></tal:case>
"
/>
</dc-workflow>
</dc-workflow>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment