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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
erp5
Commits
000dba76
Commit
000dba76
authored
Feb 20, 2018
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up some code using ActiveProcess.getResultList
parent
e26beb3a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
39 deletions
+15
-39
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Alarm_getConsistencyCheckReportLineList.py
...administration/Alarm_getConsistencyCheckReportLineList.py
+4
-7
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Alarm_getConversionToolAvailabiltyResult.py
...dministration/Alarm_getConversionToolAvailabiltyResult.py
+1
-1
bt5/erp5_syncml/SkinTemplateItem/portal_skins/erp5_syncml/SyncMLSubscription_getReportResultList.py
...ins/erp5_syncml/SyncMLSubscription_getReportResultList.py
+7
-23
bt5/erp5_upgrader/TestTemplateItem/portal_components/test.erp5.testUpgrader.py
...tTemplateItem/portal_components/test.erp5.testUpgrader.py
+0
-1
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Alarm_getReportResultList.py
...eItem/portal_skins/erp5_core/Alarm_getReportResultList.py
+3
-7
No files found.
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Alarm_getConsistencyCheckReportLineList.py
View file @
000dba76
...
@@ -8,14 +8,11 @@ if active_process is None:
...
@@ -8,14 +8,11 @@ if active_process is None:
else
:
else
:
active_process
=
context
.
getPortalObject
().
restrictedTraverse
(
active_process
)
active_process
=
context
.
getPortalObject
().
restrictedTraverse
(
active_process
)
result_list
=
[]
if
active_process
is
None
:
constraint_message_list
=
[]
return
[]
if
active_process
is
not
None
:
result_list
=
[
x
for
x
in
active_process
.
getResultList
()]
# High severity will be displayed first
result_list
.
sort
(
key
=
lambda
x
:
-
x
.
severity
)
for
result
in
result_list
:
constraint_message_list
=
[]
for
result
in
active_process
.
ActiveProcess_getResultList
():
constraint_message_list
.
extend
(
result
.
getProperty
(
'constraint_message_list'
)
or
[])
constraint_message_list
.
extend
(
result
.
getProperty
(
'constraint_message_list'
)
or
[])
return
constraint_message_list
return
constraint_message_list
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/Alarm_getConversionToolAvailabiltyResult.py
View file @
000dba76
if
process
is
None
:
if
process
is
None
:
return
False
return
False
result_list
=
process
.
getResultList
()
result_list
=
process
.
getResultList
()
return
result_list
and
bool
(
result_list
[
0
].
getProperty
(
'severity'
))
or
False
return
bool
(
result_list
and
result_list
[
0
].
getProperty
(
'severity'
))
bt5/erp5_syncml/SkinTemplateItem/portal_skins/erp5_syncml/SyncMLSubscription_getReportResultList.py
View file @
000dba76
...
@@ -3,35 +3,19 @@
...
@@ -3,35 +3,19 @@
or of the last process if nothing specified.
or of the last process if nothing specified.
"""
"""
def
getLastActiveProcess
(
sub
):
if
active_process
is
None
:
"""
# Get the last active process finished, not the current one.
This returns the last active process finished. So it will
active_process
=
context
.
getPortalObject
().
portal_catalog
.
getResultValue
(
not returns the current one
portal_type
=
'Active Process'
,
"""
limit
=
1
active_process_list
=
context
.
getPortalObject
().
portal_catalog
(
portal_type
=
'Active Process'
,
limit
=
limit
,
sort_on
=
((
'creation_date'
,
'DESC'
),
sort_on
=
((
'creation_date'
,
'DESC'
),
# XXX Work around poor resolution of MySQL dates.
# XXX Work around poor resolution of MySQL dates.
(
'CONVERT(`catalog`.`id`, UNSIGNED)'
,
'DESC'
)),
(
'CONVERT(`catalog`.`id`, UNSIGNED)'
,
'DESC'
)),
causality_uid
=
sub
.
getUid
())
causality_uid
=
sub
.
getUid
())
if
len
(
active_process_list
)
<
limit
:
process
=
None
else
:
process
=
active_process_list
[
-
1
].
getObject
()
return
process
if
active_process
is
None
:
active_process
=
getLastActiveProcess
(
context
)
else
:
else
:
active_process
=
context
.
getPortalObject
().
restrictedTraverse
(
active_process
)
active_process
=
context
.
getPortalObject
().
restrictedTraverse
(
active_process
)
result_list
=
[]
if
active_process
is
None
:
return
[]
if
active_process
is
not
None
:
result_list
=
[
x
for
x
in
active_process
.
getResultList
()]
# High severity will be displayed first
result_list
.
sort
(
key
=
lambda
x
:
-
x
.
severity
)
return
result_list
return
active_process
.
ActiveProcess_getResultList
()
bt5/erp5_upgrader/TestTemplateItem/portal_components/test.erp5.testUpgrader.py
View file @
000dba76
...
@@ -202,7 +202,6 @@ class TestUpgrader(ERP5TypeTestCase):
...
@@ -202,7 +202,6 @@ class TestUpgrader(ERP5TypeTestCase):
group_dict = DETAIL_PATTERN.match(detail).groupdict()
group_dict = DETAIL_PATTERN.match(detail).groupdict()
person = self.portal.restrictedTraverse(group_dict['relative_url'])
person = self.portal.restrictedTraverse(group_dict['relative_url'])
message_list = [m.message for m in person.checkConsistency()]
message_list = [m.message for m in person.checkConsistency()]
self.assertNotEqual(result_list, [])
self.assertEqual(len(result_list), 1)
self.assertEqual(len(result_list), 1)
return person, group_dict, detail, message_list
return person, group_dict, detail, message_list
...
...
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Alarm_getReportResultList.py
View file @
000dba76
...
@@ -8,11 +8,7 @@ if active_process is None:
...
@@ -8,11 +8,7 @@ if active_process is None:
else
:
else
:
active_process
=
context
.
getPortalObject
().
restrictedTraverse
(
active_process
)
active_process
=
context
.
getPortalObject
().
restrictedTraverse
(
active_process
)
result_list
=
[]
if
active_process
is
None
:
return
[]
if
active_process
is
not
None
:
result_list
=
[
x
for
x
in
active_process
.
getResultList
()]
# High severity will be displayed first
result_list
.
sort
(
key
=
lambda
x
:
-
x
.
severity
)
return
result_list
return
active_process
.
ActiveProcess_getResultList
()
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