~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/bugs/browser/bugtracker.py

Merged db-devel r9700 into devel.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
from zope.interface import implements
28
28
from zope.schema import Choice
29
29
from zope.schema.vocabulary import SimpleVocabulary
 
30
from zope.security.interfaces import Unauthorized
30
31
 
31
32
from canonical.cachedproperty import cachedproperty
32
33
from canonical.database.sqlbase import flush_database_updates
79
80
# of.
80
81
NO_DIRECT_CREATION_TRACKERS = (
81
82
    SINGLE_INSTANCE_TRACKERS + (
82
 
        BugTrackerType.EMAILADDRESS,))
 
83
        BugTrackerType.EMAILADDRESS,
 
84
        )
 
85
    )
83
86
 
84
87
 
85
88
class BugTrackerSetNavigation(GetitemNavigation):
185
188
            has_more_pillars = False
186
189
        return {
187
190
            'pillars': pillars[:self.pillar_limit],
188
 
            'has_more_pillars': has_more_pillars
 
191
            'has_more_pillars': has_more_pillars,
189
192
        }
190
193
 
191
194
 
392
395
    def cancel_url(self):
393
396
        return canonical_url(self.context)
394
397
 
 
398
    def reschedule_action_condition(self, action):
 
399
        """Return True if the user can see the reschedule action."""
 
400
        user_can_reset_watches = check_permission(
 
401
            "launchpad.Admin", self.context)
 
402
        return (
 
403
            user_can_reset_watches and
 
404
            self.context.watches.count() > 0)
 
405
 
 
406
    @action(
 
407
        'Reschedule all watches', name='reschedule',
 
408
        condition=reschedule_action_condition)
 
409
    def rescheduleAction(self, action, data):
 
410
        """Reschedule all the watches for the bugtracker."""
 
411
        self.context.resetWatches()
 
412
        self.request.response.addInfoNotification(
 
413
            "All bug watches on %s have been rescheduled." %
 
414
            self.context.title)
 
415
        self.next_url = canonical_url(self.context)
 
416
 
395
417
 
396
418
class BugTrackerNavigation(Navigation):
397
419