~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

  • Committer: Curtis Hovey
  • Date: 2011-06-21 14:04:50 UTC
  • mfrom: (13270 devel)
  • mto: This revision was merged to the branch mainline in revision 13272.
  • Revision ID: curtis.hovey@canonical.com-20110621140450-sx2v4584sla4urfc
Merged devel

Show diffs side-by-side

added added

removed removed

Lines of Context:
329
329
        self.extra_data = FileBugData()
330
330
 
331
331
    def initialize(self):
 
332
        # redirect_ubuntu_filebug is a cached_property.
 
333
        # Access it first just to compute its value. Because it
 
334
        # makes a DB access to get the bug supervisor, it causes
 
335
        # trouble in tests when form validation errors occur. Because the
 
336
        # transaction is doomed, the storm cache is invalidated and accessing
 
337
        # the property will result in a a LostObjectError, because
 
338
        # the created objects disappeared. Not likely a problem in production
 
339
        # since the objects will still be in the DB, but doesn't hurt there
 
340
        # either. It makes for better diagnosis of failing tests.
 
341
        if self.redirect_ubuntu_filebug:
 
342
            pass
332
343
        LaunchpadFormView.initialize(self)
333
344
        if (not self.redirect_ubuntu_filebug and
334
345
            self.extra_data_token is not None and
473
484
                    distribution = self.context.distribution
474
485
 
475
486
                try:
476
 
                    distribution.guessPackageNames(packagename)
 
487
                    distribution.guessPublishedSourcePackageName(packagename)
477
488
                except NotFoundError:
478
489
                    if distribution.series:
479
490
                        # If a distribution doesn't have any series,
590
601
            # package name, so let the Soyuz API figure it out for us.
591
602
            packagename = str(packagename.name)
592
603
            try:
593
 
                sourcepackagename, binarypackagename = (
594
 
                    context.guessPackageNames(packagename))
 
604
                sourcepackagename = context.guessPublishedSourcePackageName(
 
605
                    packagename)
595
606
            except NotFoundError:
596
 
                # guessPackageNames may raise NotFoundError. It would be
597
 
                # nicer to allow people to indicate a package even if
598
 
                # never published, but the quick fix for now is to note
599
 
                # the issue and move on.
600
607
                notifications.append(
601
608
                    "The package %s is not published in %s; the "
602
609
                    "bug was targeted only to the distribution."
608
615
                        packagename, context.displayname))
609
616
            else:
610
617
                context = context.getSourcePackage(sourcepackagename.name)
611
 
                params.binarypackagename = binarypackagename
612
618
 
613
619
        extra_data = self.extra_data
614
620
        if extra_data.extra_description: