Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
mentors.debian.net
debexpo
Commits
aec6c204
Commit
aec6c204
authored
Aug 16, 2012
by
Clément Schreiner
Browse files
Closedbugs plugin now working with the new API.
parent
1484b9fc
Changes
2
Hide whitespace changes
Inline
Side-by-side
debexpo/plugins/closedbugs.py
View file @
aec6c204
...
...
@@ -95,14 +95,19 @@ class ClosedBug(PluginResult):
@
property
def
package
(
self
):
return
self
[
'package'
]
@
property
def
is_wnpp
(
self
):
return
self
.
package
==
'wnpp'
def
__str__
(
self
):
if
self
.
exists
:
string
=
'{
nam
e} ({severity}: {subject}'
.
format
(
nam
e
=
self
[
'
nam
e'
],
severity
=
self
.
severity
,
string
=
'{
packag
e} ({severity}: {subject}'
.
format
(
packag
e
=
self
[
'
packag
e'
],
severity
=
self
[
'
severity
'
]
,
subject
=
self
[
'subject'
])
else
:
string
=
'
Non-existent bug #{}
'
.
format
(
self
.
number
)
string
=
'
Bug #{} does not exist for
'
.
format
(
self
.
number
)
return
string
...
...
@@ -126,6 +131,14 @@ class ClosedBugsPlugin(QAPlugin):
bugs
=
[
int
(
x
)
for
x
in
self
.
changes
[
'Closes'
].
split
()]
test_result
=
self
.
new_test_result
(
nb_closed
=
0
,
nb_errors
=
0
,
wnpp
=
'false'
)
if
not
bugs
:
log
.
debug
(
'Package does not close any bugs'
)
return
if
bugs
:
log
.
debug
(
'Creating SOAP proxy to bugs.debian.org'
)
try
:
...
...
@@ -158,51 +171,44 @@ class ClosedBugsPlugin(QAPlugin):
severity
=
constants
.
PLUGIN_SEVERITY_INFO
nb_closed
=
0
nb_errors
=
0
wnpp
=
False
for
bug
in
bugs
:
bug_result
=
self
.
new_result
(
ClosedBug
,
number
=
bug
)
if
not
bug
in
raw_bugs
:
log
.
debug
(
'{} does not exist'
.
format
(
bug
))
bug_result
.
exists
=
False
bug_result
.
belongs
=
False
bug_result
.
is_error
=
False
bug_result
.
is_error
=
True
test_result
.
nb_errors
+=
1
severity
=
max
(
severity
,
constants
.
PLUGIN_SEVERITY_ERROR
)
nb_errors
+=
1
continue
bug_result
.
exists
=
True
log
.
debug
(
'Found bug {}'
.
format
(
bug
))
package
=
raw_bugs
[
bug
][
'package'
]
bug_result
[
'
nam
e'
]
=
package
bug_result
[
'
packag
e'
]
=
package
bug_result
[
'subject'
]
=
raw_bugs
[
bug
][
'subject'
]
bug_result
[
'severity'
]
=
raw_bugs
[
bug
][
'severity'
]
source
=
raw_bugs
[
'source'
].
split
(
', '
)
bug_result
.
belongs
=
True
source
=
raw_bugs
[
bug
][
'source'
].
split
(
', '
)
if
name
==
'wnpp'
:
bug_result
.
wnpp
=
True
wnpp
=
True
nb_closed
+=
1
if
package
==
'wnpp'
:
log
.
debug
(
'Package closes a wnpp bug'
)
test_result
.
nb_closed
+=
1
test_result
.
closes_wnpp
=
True
bug_result
.
belongs
=
True
elif
self
.
changes
[
'Source'
]
in
source
:
nb_closed
+=
1
test_result
.
nb_closed
+=
1
bug_result
.
belongs
=
True
else
:
bug_result
.
belongs
=
False
nb_errors
+=
1
severity
=
max
(
severity
,
constants
.
PLUGIN_SEVERITY_ERROR
)
test_result
.
nb_errors
+=
1
test_result
[
'
severity
'
]
=
max
(
severity
,
constants
.
PLUGIN_SEVERITY_ERROR
)
test_result
=
self
.
new_test_result
(
nb_errors
=
nb_errors
,
nb_closed
=
nb_closed
,
wnpp
=
wnpp
,
severity
=
severity
)
else
:
log
.
debug
(
'Package does not close any bugs'
)
plugin
=
ClosedBugsPlugin
models
=
[
...
...
debexpo/templates/plugins/closedbugs/html.mako
View file @
aec6c204
...
...
@@ -2,22 +2,28 @@
${test_result}
</div>
<div class="qa-content">
%if test_result.nb_errors:
%
if test_result.nb_errors:
Errors:
<ul class="bugs-errors">
% for bug in filter(lambda b: b.is_error, results['closed_bug']):
<li>${bug}</li>
% for bug in filter(lambda b
ug
: b
ug
.is_error, results['closed_bug']):
<li>${bug}</li>
'
% endfor
</ul>
%endif
%
endif
<ul class="bugs-closed">
% for bug in filter(lambda b: b.is_closed, results["closed_bug"]):
<%
bugs = test_result.get_bugs()
%>
% for package in bugs:
<li>
<a href="http://bugs.debian.org/${
bug.
package}">${
bug.
package}</a>:
<a href="http://bugs.debian.org/${package}">${package}</a>:
<ul>
% for bug
num, title, severity in o.rich_data["
bugs
"]
[package]:
% for bug
in
bugs[package]:
<li>
<a href="http://bugs.debian.org/${bugnum}">#${bugnum}</a> (${severity}): ${title}
<a href="http://bugs.debian.org/${bug.number}">
#${bug.number}
</a>
(${bug['severity']}): ${bug['subject']}
</li>
% endfor
</ul>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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