488
488
look it up in Ubuntu to retrieve the distro_source_package
489
489
object, and link it to this component.
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
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))
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" % (