Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Lukas Niegsch
erp5
Commits
e54e7c68
Commit
e54e7c68
authored
Jun 22, 2015
by
wenjie.zheng
Committed by
Sebastien Robin
Jul 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Workflow.py: state showAsXML show the same structure as DC state showAsXML.
parent
13692467
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
16 deletions
+33
-16
product/ERP5Workflow/Document/Workflow.py
product/ERP5Workflow/Document/Workflow.py
+33
-16
No files found.
product/ERP5Workflow/Document/Workflow.py
View file @
e54e7c68
...
...
@@ -747,14 +747,14 @@ class Workflow(IdAsReferenceMixin("workflow_", "prefix"), XMLObject):
# workflow as XML, need to rename DC workflow's portal_type before comparison.
workflow
=
SubElement
(
root
,
'workflow'
,
attrib
=
dict
(
id
=
self
.
getReference
(),
attrib
=
dict
(
reference
=
self
.
getReference
(),
portal_type
=
self
.
getPortalType
()))
for
prop_id
in
sorted
(
workflow_prop_id_to_show
):
# In most case, we should not synchronize acquired properties
if
prop_id
not
in
(
'uid'
,
'workflow_history'
,
'id'
,
'portal_type'
,):
if
prop_id
==
'permissions'
:
value
=
self
.
getProperty
(
'workflow_managed_permission_list'
)
value
=
tuple
(
self
.
getProperty
(
'workflow_managed_permission_list'
)
)
prop_type
=
self
.
getPropertyType
(
'workflow_managed_permission_list'
)
sub_object
=
SubElement
(
workflow
,
prop_id
,
attrib
=
dict
(
type
=
prop_type
))
elif
prop_id
==
'initial_state'
:
...
...
@@ -826,20 +826,29 @@ class Workflow(IdAsReferenceMixin("workflow_", "prefix"), XMLObject):
local_group_node = SubElement(workflow, 'local_group',
attrib=dict(id=group_role[0], type='tokens'))
local_group_node.append(marshaller(group_role[1]))
"""
# 1. State as XML
state_reference_list
=
[]
state_list
=
self
.
objectValues
(
portal_type
=
'State'
)
# show reference instead of id
state_prop_id_to_show = ['
reference', '
title', 'description',
'
categories_list', 'is_selected', 'state_
permission_roles']
state_prop_id_to_show
=
[
'title'
,
'description'
,
'
transitions'
,
'
permission_roles'
]
for
sdef
in
state_list
:
state_reference_list
.
append
(
sdef
.
getReference
())
states
=
SubElement
(
workflow
,
'states'
,
attrib
=
dict
(
state_list
=
str
(
state_reference_list
),
number_of_element
=
str
(
len
(
state_reference_list
))))
for
sdef
in
state_list
:
state = SubElement(states, 'state', attrib=dict(reference=sdef.getReference()))
state
=
SubElement
(
states
,
'state'
,
attrib
=
dict
(
reference
=
sdef
.
getReference
()
,
portal_type
=
sdef
.
getPortalType
()
))
for
property_id
in
sorted
(
state_prop_id_to_show
):
if
property_id
==
'permission_roles'
:
property_value
=
sdef
.
getProperty
(
'state_permission_roles'
)
property_type
=
sdef
.
getPropertyType
(
'state_permission_roles'
)
sub_object
=
SubElement
(
state
,
property_id
,
attrib
=
dict
(
type
=
'string'
))
elif
property_id
==
'transitions'
:
property_value
=
sdef
.
getDestinationValueList
()
property_type
=
sdef
.
getPropertyType
(
'categories_list'
)
sub_object
=
SubElement
(
state
,
property_id
,
attrib
=
dict
(
type
=
'multiple selection'
))
else
:
property_value
=
sdef
.
getProperty
(
property_id
)
if
property_value
is
None
:
# do not register if not defined.
...
...
@@ -847,6 +856,7 @@ class Workflow(IdAsReferenceMixin("workflow_", "prefix"), XMLObject):
else
:
property_type
=
sdef
.
getPropertyType
(
property_id
)
sub_object
=
SubElement
(
state
,
property_id
,
attrib
=
dict
(
type
=
property_type
))
if
property_type
in
(
'object'
,):
# We may have very long lines, so we should split
property_value
=
aq_base
(
property_value
)
...
...
@@ -865,6 +875,13 @@ class Workflow(IdAsReferenceMixin("workflow_", "prefix"), XMLObject):
else
:
raise
ValueError
(
"XMLExportImport failed, the data is undefined"
)
elif
property_type
in
(
'lines'
,
'tokens'
,):
if
property_id
==
'transitions'
:
value_list
=
property_value
value_reference_list
=
[]
for
value
in
value_list
:
value_reference_list
.
append
(
value
.
getReference
())
sub_object
.
text
=
str
(
tuple
(
value_reference_list
))
else
:
property_value
=
[
word
.
decode
(
'utf-8'
).
encode
(
'ascii'
,
'xmlcharrefreplace'
)
\
for
word
in
property_value
]
sub_object
.
append
(
marshaller
(
property_value
))
...
...
@@ -875,7 +892,7 @@ class Workflow(IdAsReferenceMixin("workflow_", "prefix"), XMLObject):
sub_object
.
text
=
unicode
(
escape
(
property_value
),
'utf-8'
)
elif
property_type
!=
'None'
:
sub_object
.
text
=
str
(
property_value
)
"""
# 2. Transition as XML
transition_reference_list = []
transition_list = self.objectValues(portal_type='Transition')
...
...
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