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
Carlos Ramos Carreño
erp5
Commits
604b994b
Commit
604b994b
authored
Mar 13, 2023
by
Kazuhiko Shiozaki
Committed by
Jérome Perrin
Apr 01, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
py2/py3: cmp() and sort(cmp=...) do not exist in Python 3.
parent
5b1adf81
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
6 deletions
+2
-6
product/ERP5/Document/Alarm.py
product/ERP5/Document/Alarm.py
+2
-6
No files found.
product/ERP5/Document/Alarm.py
View file @
604b994b
...
@@ -348,12 +348,8 @@ class Alarm(XMLObject, PeriodicityMixin):
...
@@ -348,12 +348,8 @@ class Alarm(XMLObject, PeriodicityMixin):
result_list
=
[
x
for
x
in
active_process
.
getResultList
()
if
x
is
not
None
]
result_list
=
[
x
for
x
in
active_process
.
getResultList
()
if
x
is
not
None
]
attachment_list
=
[]
attachment_list
=
[]
if
len
(
result_list
):
if
len
(
result_list
):
def
sort_result_list
(
a
,
b
):
# Here we assume that severity type is int or float and summary type is same for all entries.
result
=
-
cmp
(
a
.
severity
,
b
.
severity
)
result_list
.
sort
(
key
=
lambda
e
:
(
-
e
.
severity
,
e
.
summary
))
if
result
==
0
:
result
=
cmp
(
a
.
summary
,
b
.
summary
)
return
result
result_list
.
sort
(
sort_result_list
)
rendered_alarm_result_list
=
[
'%02i summary: %s
\
n
%s
\
n
----'
%
rendered_alarm_result_list
=
[
'%02i summary: %s
\
n
%s
\
n
----'
%
(
int
(
getattr
(
x
,
'severity'
,
0
)),
getattr
(
x
,
'summary'
,
''
),
getattr
(
x
,
'detail'
,
''
))
(
int
(
getattr
(
x
,
'severity'
,
0
)),
getattr
(
x
,
'summary'
,
''
),
getattr
(
x
,
'detail'
,
''
))
for
x
in
result_list
]
for
x
in
result_list
]
...
...
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