13222.4.1
by Jeroen Vermeulen
Show error icon for DSD sync failures. |
1 |
# Copyright 2011 Canonical Ltd. This software is licensed under the
|
2 |
# GNU Affero General Public License version 3 (see the file LICENSE).
|
|
3 |
||
4 |
"""View and helper for `DistroSeriesDifferenceComment`."""
|
|
5 |
||
6 |
__metaclass__ = type |
|
7 |
||
8 |
from zope.component import getUtility |
|
9 |
||
14600.2.2
by Curtis Hovey
Moved webapp to lp.services. |
10 |
from lp.services.webapp import LaunchpadView |
13222.4.1
by Jeroen Vermeulen
Show error icon for DSD sync failures. |
11 |
from lp.app.interfaces.launchpad import ILaunchpadCelebrities |
12 |
||
13 |
||
14 |
class DistroSeriesDifferenceCommentView(LaunchpadView): |
|
15 |
"""View class for `DistroSeriesDifferenceComment`.
|
|
16 |
||
13222.4.2
by Jeroen Vermeulen
Cleanup. Much simpler now. |
17 |
:ivar is_error: Whether the comment is an error message from Launchpad.
|
18 |
Package copy failures are stored as `DistroSeriesDifferenceComments`,
|
|
19 |
but rendered to be visually recognizable as errors.
|
|
13222.4.1
by Jeroen Vermeulen
Show error icon for DSD sync failures. |
20 |
"""
|
21 |
||
22 |
def __init__(self, *args, **kwargs): |
|
23 |
super(DistroSeriesDifferenceCommentView, self).__init__( |
|
24 |
*args, **kwargs) |
|
25 |
error_persona = getUtility(ILaunchpadCelebrities).janitor |
|
13222.4.2
by Jeroen Vermeulen
Cleanup. Much simpler now. |
26 |
self.is_error = (self.context.comment_author == error_persona) |