Beispiel #1
0
    def is_project_milestone(self):
        """Check, if the current milestone is a project milestone.

        Return true, if the current milestone is a project milestone or
        a project milestone tag, else return False."""
        return (IProjectGroupMilestone.providedBy(self.context)
                or self.is_project_milestone_tag)
    def subscribe(self):
        """The subscribe menu link.

        If the user, or any of the teams he's a member of, already has a
        subscription to the context, the link offer to edit the subscriptions
        and displays the edit icon. Otherwise, the link offers to subscribe
        and displays the add icon.
        """
        sst = self._getSST()

        if sst.userHasBugSubscriptions(self.user):
            text = 'Edit bug mail subscription'
            icon = 'edit'
        else:
            text = 'Subscribe to bug mail'
            icon = 'add'
        # ProjectGroup milestones aren't really structural subscription
        # targets as they're not real milestones, so you can't subscribe to
        # them.
        if (not IProjectGroupMilestone.providedBy(sst) and
            sst.userCanAlterBugSubscription(self.user, self.user)):
            enabled = True
        else:
            enabled = False

        return Link('+subscribe', text, icon=icon, enabled=enabled)
    def subscribe(self):
        """The subscribe menu link.

        If the user, or any of the teams they're a member of, already has a
        subscription to the context, the link offers to edit the subscriptions
        and displays the edit icon. Otherwise, the link offers to subscribe
        and displays the add icon.
        """
        sst = self._getSST()

        if sst.userHasBugSubscriptions(self.user):
            text = 'Edit bug mail subscription'
            icon = 'edit'
        else:
            text = 'Subscribe to bug mail'
            icon = 'add'
        # ProjectGroup milestones aren't really structural subscription
        # targets as they're not real milestones, so you can't subscribe to
        # them.
        if (not IProjectGroupMilestone.providedBy(sst)
                and sst.userCanAlterBugSubscription(self.user, self.user)):
            enabled = True
        else:
            enabled = False

        return Link('+subscribe', text, icon=icon, enabled=enabled)
    def is_project_milestone(self):
        """Check, if the current milestone is a project milestone.

        Return true, if the current milestone is a project milestone or
        a project milestone tag, else return False."""
        return (
            IProjectGroupMilestone.providedBy(self.context) or
            self.is_project_milestone_tag)
 def delete(self):
     """The link to delete this milestone."""
     text = 'Delete milestone'
     # ProjectMilestones are virtual.
     enabled = not IProjectGroupMilestone.providedBy(self.context)
     summary = "Delete milestone"
     return Link(
         '+delete', text, icon='trash-icon',
         summary=summary, enabled=enabled)
 def edit(self):
     """The link to edit this milestone."""
     text = 'Change details'
     # ProjectMilestones are virtual milestones and do not have
     # any properties which can be edited.
     enabled = not IProjectGroupMilestone.providedBy(self.context)
     summary = "Edit this milestone"
     return Link(
         '+edit', text, icon='edit', summary=summary, enabled=enabled)
Beispiel #7
0
 def delete(self):
     """The link to delete this milestone."""
     text = 'Delete milestone'
     # ProjectMilestones are virtual.
     enabled = not IProjectGroupMilestone.providedBy(self.context)
     summary = "Delete milestone"
     return Link('+delete',
                 text,
                 icon='trash-icon',
                 summary=summary,
                 enabled=enabled)
Beispiel #8
0
 def edit(self):
     """The link to edit this milestone."""
     text = 'Change details'
     # ProjectMilestones are virtual milestones and do not have
     # any properties which can be edited.
     enabled = not IProjectGroupMilestone.providedBy(self.context)
     summary = "Edit this milestone"
     return Link('+edit',
                 text,
                 icon='edit',
                 summary=summary,
                 enabled=enabled)
    def _enabled(self):
        """Should the link be enabled?

        True if the target uses Launchpad for bugs and the user can alter the
        bug subscriptions.
        """
        sst = self._getSST()
        # ProjectGroup milestones aren't really structural subscription
        # targets as they're not real milestones, so you can't subscribe to
        # them.
        if IProjectGroupMilestone.providedBy(sst):
            return False
        pillar = IStructuralSubscriptionTargetHelper(sst).pillar
        return (pillar.bug_tracking_usage == ServiceUsage.LAUNCHPAD and
                sst.userCanAlterBugSubscription(self.user, self.user))
    def _enabled(self):
        """Should the link be enabled?

        True if the target uses Launchpad for bugs and the user can alter the
        bug subscriptions.
        """
        sst = self._getSST()
        # ProjectGroup milestones aren't really structural subscription
        # targets as they're not real milestones, so you can't subscribe to
        # them.
        if IProjectGroupMilestone.providedBy(sst):
            return False
        pillar = IStructuralSubscriptionTargetHelper(sst).pillar
        return (pillar.bug_tracking_usage == ServiceUsage.LAUNCHPAD
                and sst.userCanAlterBugSubscription(self.user, self.user))