~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/code/browser/codereviewcomment.py

  • Committer: Steve Kowalik
  • Date: 2011-08-07 04:05:52 UTC
  • mto: This revision was merged to the branch mainline in revision 13626.
  • Revision ID: stevenk@ubuntu.com-20110807040552-mwnxo0flmhvl35e8
Correct the notification based on review comments, and remove request{,ed}
from the function names, switching to create{,d}.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
 
1
# Copyright 2009 Canonical Ltd.  This software is licensed under the
2
2
# GNU Affero General Public License version 3 (see the file LICENSE).
3
3
 
4
4
__metaclass__ = type
24
24
    )
25
25
from zope.schema import Text
26
26
 
27
 
from lp import _
 
27
from canonical.config import config
 
28
from canonical.launchpad import _
 
29
from canonical.launchpad.interfaces.librarian import ILibraryFileAlias
 
30
from canonical.launchpad.webapp import (
 
31
    canonical_url,
 
32
    ContextMenu,
 
33
    LaunchpadView,
 
34
    Link,
 
35
    )
 
36
from canonical.launchpad.webapp.interfaces import IPrimaryContext
28
37
from lp.app.browser.launchpadform import (
29
38
    action,
30
39
    custom_widget,
33
42
from lp.code.interfaces.codereviewcomment import ICodeReviewComment
34
43
from lp.code.interfaces.codereviewvote import ICodeReviewVoteReference
35
44
from lp.services.comments.interfaces.conversation import IComment
36
 
from lp.services.config import config
37
 
from lp.services.librarian.interfaces import ILibraryFileAlias
38
 
from lp.services.propertycache import (
39
 
    cachedproperty,
40
 
    get_property_cache,
41
 
    )
42
 
from lp.services.webapp import (
43
 
    canonical_url,
44
 
    ContextMenu,
45
 
    LaunchpadView,
46
 
    Link,
47
 
    )
48
 
from lp.services.webapp.interfaces import IPrimaryContext
 
45
from lp.services.propertycache import cachedproperty
49
46
 
50
47
 
51
48
class ICodeReviewDisplayComment(IComment, ICodeReviewComment):
66
63
 
67
64
    def __init__(self, comment, from_superseded=False):
68
65
        self.comment = comment
69
 
        get_property_cache(self).has_body = bool(self.comment.message_body)
 
66
        self.has_body = bool(self.comment.message_body)
70
67
        self.has_footer = self.comment.vote is not None
71
68
        # The date attribute is used to sort the comments in the conversation.
72
69
        self.date = self.comment.message.datecreated
175
172
        """The decorated code review comment."""
176
173
        return CodeReviewDisplayComment(self.context)
177
174
 
178
 
    @property
179
 
    def page_description(self):
180
 
        return self.context.message_body
181
 
 
182
175
    # Should the comment be shown in full?
183
176
    full_comment = True
184
177
    # Show comment expanders?