~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 21:31:51 UTC
  • mto: This revision was merged to the branch mainline in revision 13177.
  • Revision ID: curtis.hovey@canonical.com-20110602213151-8dw5b6etxjteozvq
Simplified UbuntuSourcePackageNameWidget.

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
    IBugTrackerSet,
78
78
    IRemoteBug,
79
79
    )
80
 
from lp.registry.interfaces.distribution import IDistributionSet
81
80
from lp.services.propertycache import cachedproperty
82
81
 
83
82
# A set of bug tracker types for which there can only ever be one bug
472
471
    """
473
472
 
474
473
    schema = IBugTrackerComponent
475
 
    custom_widget('sourcepackagename',
476
 
                  UbuntuSourcePackageNameWidget)
 
474
    custom_widget('sourcepackagename', UbuntuSourcePackageNameWidget)
477
475
 
478
476
    @property
479
477
    def page_title(self):
528
526
        sourcepackagename = self.request.form.get(
529
527
            self.widgets['sourcepackagename'].name)
530
528
 
531
 
        distro_name = self.widgets['sourcepackagename'].distribution_name
532
 
        distribution = getUtility(IDistributionSet).getByName(distro_name)
 
529
        distribution = self.widgets['sourcepackagename'].getDistribution()
533
530
        pkg = distribution.getSourcePackage(sourcepackagename)
534
531
        bug_tracker = self.context.component_group.bug_tracker
535
532
 
536
533
        # Has this source package already been assigned to a component?
537
534
        link_comp = bug_tracker.getRemoteComponentForDistroSourcePackage(
538
 
            distro_name, sourcepackagename)
 
535
            distribution.name, sourcepackagename)
539
536
        if link_comp is not None:
540
537
            self.request.response.addNotification(
541
538
                "The %s source package is already linked to %s:%s in %s" % (
542
539
                    sourcepackagename, link_comp.component_group.name,
543
 
                    link_comp.name, distro_name))
 
540
                    link_comp.name, distribution.name))
544
541
            return
545
542
 
546
543
        component.distro_source_package = pkg
547
544
        self.request.response.addNotification(
548
545
            "%s:%s is now linked to the %s source package in %s" % (
549
546
                component.component_group.name, component.name,
550
 
                sourcepackagename, distro_name))
 
547
                sourcepackagename, distribution.name))
551
548
 
552
549
    @action('Save Changes', name='save')
553
550
    def save_action(self, action, data):