~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

  • Committer: Curtis Hovey
  • Date: 2011-06-02 22:25:18 UTC
  • mto: This revision was merged to the branch mainline in revision 13177.
  • Revision ID: curtis.hovey@canonical.com-20110602222518-9yrna93qydu2tia8
Simplified the update method.

Show diffs side-by-side

added added

removed removed

Lines of Context:
488
488
        look it up in Ubuntu to retrieve the distro_source_package
489
489
        object, and link it to this component.
490
490
        """
491
 
        component = context or self.context
492
491
        sourcepackagename = data['sourcepackagename']
493
492
        distribution = self.widgets['sourcepackagename'].getDistribution()
494
493
        dsp = distribution.getSourcePackage(sourcepackagename)
495
494
        bug_tracker = self.context.component_group.bug_tracker
496
 
 
497
495
        # Has this source package already been assigned to a component?
498
 
        old_component = bug_tracker.getRemoteComponentForDistroSourcePackage(
 
496
        component = bug_tracker.getRemoteComponentForDistroSourcePackage(
499
497
            distribution.name, sourcepackagename.name)
500
 
        if old_component is not None:
 
498
        if component is not None:
501
499
            self.request.response.addNotification(
502
500
                "The %s source package is already linked to %s:%s in %s" % (
503
501
                    sourcepackagename.name,
504
 
                    old_component.component_group.name,
505
 
                    old_component.name, distribution.name))
 
502
                    component.component_group.name,
 
503
                    component.name, distribution.name))
506
504
            return
 
505
        # The submitted component can be linked to the distro source package.
 
506
        component = context or self.context
507
507
        component.distro_source_package = dsp
508
508
        self.request.response.addNotification(
509
509
            "%s:%s is now linked to the %s source package in %s" % (