~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-12-14 18:16:47 UTC
  • mfrom: (14515 devel)
  • mto: This revision was merged to the branch mainline in revision 14593.
  • Revision ID: launchpad@pqm.canonical.com-20111214181647-jh80eps1ndcy6hns
[rs=buildbot-poller] automatic merge from stable. Revisions: 14510,
        14511, 14512, 14513, 14514, 14515 included.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
    canonical_url,
20
20
    LaunchpadView,
21
21
    )
22
 
from canonical.launchpad.webapp.authorization import check_permission
 
22
from canonical.launchpad.webapp.authorization import (
 
23
    check_permission,
 
24
    precache_permission_for_objects,
 
25
    )
23
26
from canonical.launchpad.webapp.interfaces import IPrimaryContext
24
27
from canonical.launchpad.webapp.menu import structured
25
28
from lp.app.browser.launchpadform import (
48
51
 
49
52
    def subscriptions(self):
50
53
        """Return a decorated list of branch subscriptions."""
 
54
 
 
55
        # Cache permissions so private subscribers can be rendered.
 
56
        if self.user is not None:
 
57
            subscribers = [
 
58
                subscription.person
 
59
                for subscription in self.context.subscriptions]
 
60
            precache_permission_for_objects(
 
61
                self.request, "launchpad.LimitedView", subscribers)
 
62
 
51
63
        visible_subscriptions = [
52
64
            subscription for subscription in self.context.subscriptions
53
 
            if check_permission('launchpad.View', subscription.person)]
 
65
            if check_permission('launchpad.LimitedView', subscription.person)]
54
66
        return sorted(
55
67
            visible_subscriptions,
56
68
            key=lambda subscription: subscription.person.displayname)