~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

  • Committer: Francis J. Lacoste
  • Date: 2011-12-06 20:10:56 UTC
  • mfrom: (14448 devel)
  • mto: This revision was merged to the branch mainline in revision 14474.
  • Revision ID: francis.lacoste@canonical.com-20111206201056-jk8q5euywtd4vqk7
Merge devel.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2460
2460
        bug_target = self.context.context
2461
2461
        if IDistribution.providedBy(bug_target):
2462
2462
            return (
2463
 
                'bugsupervisor',
2464
 
                'securitycontact',
2465
2463
                'cve',
2466
2464
                )
2467
2465
        elif IDistroSeries.providedBy(bug_target):
2471
2469
                )
2472
2470
        elif IProduct.providedBy(bug_target):
2473
2471
            return (
2474
 
                'bugsupervisor',
2475
 
                'securitycontact',
2476
2472
                'cve',
2477
2473
                )
2478
2474
        elif IProductSeries.providedBy(bug_target):
2524
2520
    custom_widget('assignee', PersonPickerWidget)
2525
2521
    custom_widget('bug_reporter', PersonPickerWidget)
2526
2522
    custom_widget('bug_commenter', PersonPickerWidget)
2527
 
    custom_widget('bug_supervisor', PersonPickerWidget)
 
2523
    custom_widget('structural_subscriber', PersonPickerWidget)
2528
2524
    custom_widget('subscriber', PersonPickerWidget)
2529
2525
 
2530
2526
    @cachedproperty
2676
2672
            cache.objects.update(_getBatchInfo(batch_navigator.batch))
2677
2673
 
2678
2674
    @property
 
2675
    def show_config_portlet(self):
 
2676
        if (IDistribution.providedBy(self.context) or
 
2677
            IProduct.providedBy(self.context)):
 
2678
            return True
 
2679
        else:
 
2680
            return False
 
2681
 
 
2682
    @property
2679
2683
    def columns_to_show(self):
2680
2684
        """Returns a sequence of column names to be shown in the listing."""
2681
2685
        upstream_context = self._upstreamContext()
3049
3053
            IDistroSeries.providedBy(context) or
3050
3054
            ISourcePackage.providedBy(context))
3051
3055
 
3052
 
    def shouldShowSupervisorWidget(self):
3053
 
        """
3054
 
        Should the bug supervisor widget be shown on the advanced search page?
3055
 
        """
3056
 
        return True
 
3056
    def shouldShowStructuralSubscriberWidget(self):
 
3057
        """Should the structural subscriber widget be shown on the page?
 
3058
 
 
3059
        Show the widget when there are subordinate structures.
 
3060
        """
 
3061
        return self.structural_subscriber_label is not None
3057
3062
 
3058
3063
    def shouldShowNoPackageWidget(self):
3059
3064
        """Should the widget to filter on bugs with no package be shown?
3096
3101
        """Should the User's Teams portlet me shown in the results?"""
3097
3102
        return False
3098
3103
 
 
3104
    @property
 
3105
    def structural_subscriber_label(self):
 
3106
        if IDistribution.providedBy(self.context):
 
3107
            return 'Package, or series subscriber'
 
3108
        elif IDistroSeries.providedBy(self.context):
 
3109
            return 'Package subscriber'
 
3110
        elif IProduct.providedBy(self.context):
 
3111
            return 'Series subscriber'
 
3112
        elif IProjectGroup.providedBy(self.context):
 
3113
            return 'Project or series subscriber'
 
3114
        elif IPerson.providedBy(self.context):
 
3115
            return 'Project, distribution, package, or series subscriber'
 
3116
        else:
 
3117
            return None
 
3118
 
3099
3119
    def getSortLink(self, colname):
3100
3120
        """Return a link that can be used to sort results by colname."""
3101
3121
        form = self.request.form
3198
3218
        error_message = _(
3199
3219
            "There's no person with the name or email address '%s'.")
3200
3220
 
3201
 
        for name in ('assignee', 'bug_reporter', 'bug_supervisor',
 
3221
        for name in ('assignee', 'bug_reporter', 'structural_subscriber',
3202
3222
                     'bug_commenter', 'subscriber'):
3203
3223
            if self.getFieldError(name):
3204
3224
                self.setFieldError(
4332
4352
        """Return a formatted summary of the change."""
4333
4353
        if self.target is not None:
4334
4354
            # This is a bug task.  We want the attribute, as filtered out.
4335
 
            return self.attribute
 
4355
            summary = self.attribute
4336
4356
        else:
4337
4357
            # Otherwise, the attribute is more normalized than what we want.
4338
4358
            # Use "whatchanged," which sometimes is more descriptive.
4339
 
            return self.whatchanged
 
4359
            summary = self.whatchanged
 
4360
        return self.get_better_summary(summary)
 
4361
 
 
4362
    def get_better_summary(self, summary):
 
4363
        """For some activities, we want a different summary for the UI.
 
4364
 
 
4365
        Some event names are more descriptive as data, but less relevant to
 
4366
        users, who are unfamiliar with the lp code."""
 
4367
        better_summaries = {
 
4368
            'bug task deleted': 'no longer affects',
 
4369
            }
 
4370
        return better_summaries.get(summary, summary)
4340
4371
 
4341
4372
    @property
4342
4373
    def _formatted_tags_change(self):
4415
4446
                    return_dict[key] = cgi.escape(return_dict[key])
4416
4447
 
4417
4448
        elif attribute == 'bug task deleted':
4418
 
            return 'no longer affects %s' % self.oldvalue
 
4449
            return self.oldvalue
4419
4450
 
4420
4451
        else:
4421
4452
            # Our default state is to just return oldvalue and newvalue.