launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #04442
[Merge] lp:~wgrant/launchpad/createtask-and-addtask into lp:launchpad
William Grant has proposed merging lp:~wgrant/launchpad/createtask-and-addtask into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~wgrant/launchpad/createtask-and-addtask/+merge/69950
Trim most of Bug.addTask and BugTaskSet.createTask by making them take an IBugTarget, rather than a full split bug target key.
A feeeew tests needed fixing.
--
https://code.launchpad.net/~wgrant/launchpad/createtask-and-addtask/+merge/69950
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/createtask-and-addtask into lp:launchpad.
=== modified file 'lib/lp/archiveuploader/tests/nascentupload-closing-bugs.txt'
--- lib/lp/archiveuploader/tests/nascentupload-closing-bugs.txt 2010-10-17 15:44:08 +0000
+++ lib/lp/archiveuploader/tests/nascentupload-closing-bugs.txt 2011-08-01 05:38:29 +0000
@@ -44,8 +44,7 @@
>>> the_bug = getUtility(IBugSet).get(the_bug_id)
>>> bugtask = getUtility(IBugTaskSet).createTask(
- ... bug=the_bug, owner=bugtask_owner, distribution=ubuntu,
- ... sourcepackagename=ubuntu_bar.sourcepackagename)
+ ... the_bug, bugtask_owner, ubuntu_bar)
Inspect the current bugtasks for bug #6:
=== modified file 'lib/lp/bugs/browser/tests/bug-views.txt'
--- lib/lp/bugs/browser/tests/bug-views.txt 2011-06-28 15:04:29 +0000
+++ lib/lp/bugs/browser/tests/bug-views.txt 2011-08-01 05:38:29 +0000
@@ -526,10 +526,7 @@
>>> current_user = getUtility(ILaunchBag).user
- >>> bugtaskset.createTask(
- ... owner=current_user, bug=bug_one,
- ... distribution=evolution.distribution,
- ... sourcepackagename=evolution.sourcepackagename)
+ >>> bugtaskset.createTask(bug_one, current_user, evolution)
<BugTask ...>
A nomination row will be included for evolution now too.
=== modified file 'lib/lp/bugs/browser/tests/special/bugs-fixed-elsewhere.txt'
--- lib/lp/bugs/browser/tests/special/bugs-fixed-elsewhere.txt 2011-06-28 15:04:29 +0000
+++ lib/lp/bugs/browser/tests/special/bugs-fixed-elsewhere.txt 2011-08-01 05:38:29 +0000
@@ -45,7 +45,7 @@
>>> from lp.bugs.interfaces.bugtask import IBugTaskSet
>>> elsewhere = getUtility(IBugTaskSet).createTask(
- ... bug, owner=getUtility(ILaunchBag).user, product=evolution)
+ ... bug, getUtility(ILaunchBag).user, evolution)
>>> get_view().bugs_fixed_elsewhere_count
0
@@ -88,7 +88,7 @@
True
>>> another_elsewhere = getUtility(IBugTaskSet).createTask(
- ... another_bug, owner=getUtility(ILaunchBag).user, product=evolution)
+ ... another_bug, getUtility(ILaunchBag).user, evolution)
>>> another_elsewhere.transitionToStatus(
... BugTaskStatus.FIXRELEASED, getUtility(ILaunchBag).user)
=== modified file 'lib/lp/bugs/browser/tests/test_bugtask.py'
--- lib/lp/bugs/browser/tests/test_bugtask.py 2011-07-25 11:22:55 +0000
+++ lib/lp/bugs/browser/tests/test_bugtask.py 2011-08-01 05:38:29 +0000
@@ -496,8 +496,7 @@
product_bar = self.factory.makeProduct(name="bar")
foo_bug = self.factory.makeBug(product=product_foo)
bugtask_set = getUtility(IBugTaskSet)
- bugtask_set.createTask(
- bug=foo_bug, owner=foo_bug.owner, product=product_bar)
+ bugtask_set.createTask(foo_bug, foo_bug.owner, product_bar)
removeSecurityProxy(product_bar).active = False
=== modified file 'lib/lp/bugs/doc/bug-nomination.txt'
--- lib/lp/bugs/doc/bug-nomination.txt 2011-07-27 08:04:46 +0000
+++ lib/lp/bugs/doc/bug-nomination.txt 2011-08-01 05:38:29 +0000
@@ -262,10 +262,7 @@
... distroseries=ubuntu.currentseries,
... sourcepackagename=ubuntu_tbird.sourcepackagename)
- >>> getUtility(IBugTaskSet).createTask(
- ... bug=bug_one, owner=no_privs,
- ... distribution=ubuntu,
- ... sourcepackagename=ubuntu_tbird.sourcepackagename)
+ >>> getUtility(IBugTaskSet).createTask(bug_one, no_privs, ubuntu_tbird)
<BugTask ...>
>>> tasks = sorted(
@@ -409,9 +406,7 @@
>>> ubuntu_evolution = ubuntu.getSourcePackage('evolution')
>>> getUtility(IBugTaskSet).createTask(
- ... bug=bug_one, owner=no_privs,
- ... distribution=ubuntu,
- ... sourcepackagename=ubuntu_evolution.sourcepackagename)
+ ... bug_one, no_privs, ubuntu_evolution)
<BugTask ...>
>>> tasks = sorted(
=== modified file 'lib/lp/bugs/doc/bug-set-status.txt'
--- lib/lp/bugs/doc/bug-set-status.txt 2011-07-27 08:04:46 +0000
+++ lib/lp/bugs/doc/bug-set-status.txt 2011-08-01 05:38:29 +0000
@@ -90,7 +90,7 @@
... firefox = getUtility(IProductSet).getByName('firefox')
... firefox_trunk = firefox.getSeries('trunk')
... ignore = getUtility(IBugTaskSet).createTask(
- ... bug, productseries=firefox_trunk, owner=no_priv)
+ ... bug, no_priv, firefox_trunk)
>>> bug = getUtility(IBugSet).get(bug_id)
>>> no_priv = getUtility(IPersonSet).getByName('no-priv')
=== modified file 'lib/lp/bugs/doc/bug.txt'
--- lib/lp/bugs/doc/bug.txt 2011-07-21 07:11:09 +0000
+++ lib/lp/bugs/doc/bug.txt 2011-08-01 05:38:29 +0000
@@ -642,7 +642,7 @@
thunderbird
>>> thunderbird_task = getUtility(IBugTaskSet).createTask(
- ... bug=firefox_bug, owner=foobar, product=thunderbird)
+ ... firefox_bug, foobar, thunderbird)
>>> current_date_last_updated = firefox_bug.date_last_updated
@@ -954,8 +954,7 @@
Let's add a new task to b8 to see if that affects the completeness.
- >>> newtask = getUtility(IBugTaskSet).createTask(
- ... bug=b8, product=firefox, owner=b8.owner)
+ >>> newtask = getUtility(IBugTaskSet).createTask(b8, b8.owner, firefox)
>>> newtask.status.name
'NEW'
>>> b8.is_complete
=== modified file 'lib/lp/bugs/doc/bugactivity.txt'
--- lib/lp/bugs/doc/bugactivity.txt 2011-07-21 07:11:09 +0000
+++ lib/lp/bugs/doc/bugactivity.txt 2011-08-01 05:38:29 +0000
@@ -80,8 +80,7 @@
>>> mozilla_firefox = getUtility(ISourcePackageNameSet)['mozilla-firefox']
>>> ubuntu = getUtility(IDistributionSet).getByName('ubuntu')
>>> source_package_assignment = getUtility(IBugTaskSet).createTask(
- ... bug=bug, sourcepackagename=mozilla_firefox,
- ... distribution=ubuntu,owner=user)
+ ... bug, user, ubuntu.getSourcePackage(mozilla_firefox))
>>> edit_fields = [
... "distribution", "sourcepackagename", "milestone", "status",
... "importance", "assignee", "bugwatch"]
@@ -129,7 +128,7 @@
==================================
>>> product_assignment = getUtility(IBugTaskSet).createTask(
- ... bug=bug, product=getUtility(IProductSet)['thunderbird'], owner=user)
+ ... bug, user, getUtility(IProductSet)['thunderbird'])
>>> edit_fields = [
... "product", "milestone", "status", "assignee", "bugwatch",
... "importance"]
=== modified file 'lib/lp/bugs/doc/bugnotifications.txt'
--- lib/lp/bugs/doc/bugnotifications.txt 2011-07-21 07:11:09 +0000
+++ lib/lp/bugs/doc/bugnotifications.txt 2011-08-01 05:38:29 +0000
@@ -107,9 +107,8 @@
>>> debian = getUtility(IDistributionSet).get(3)
>>> firefox_source = getUtility(ISourcePackageNameSet).get(1)
>>> firefox_crashes_in_debian = getUtility(IBugTaskSet).createTask(
- ... bug=firefox_crashes, distribution=debian,
- ... sourcepackagename=firefox_source,
- ... owner=bug_submitter)
+ ... firefox_crashes, bug_submitter,
+ ... debian.getSourcePackage(firefox_source))
>>> notify(ObjectCreatedEvent(
... firefox_crashes_in_debian, firefox_crashes_in_debian.owner))
@@ -134,8 +133,8 @@
>>> sid = getUtility(IDistroSeriesSet).get(8)
>>> firefox_crashes_in_sid = getUtility(IBugTaskSet).createTask(
- ... bug=firefox_crashes, distroseries=sid,
- ... sourcepackagename=firefox_source, owner=bug_submitter)
+ ... firefox_crashes, bug_submitter,
+ ... sid.getSourcePackage(firefox_source))
>>> notify(ObjectCreatedEvent(
... firefox_crashes_in_sid, firefox_crashes_in_sid.owner))
@@ -163,7 +162,7 @@
>>> evolution = getUtility(IProductSet).get(5)
>>> evolution_crashes_too = getUtility(IBugTaskSet).createTask(
- ... bug=firefox_crashes, product=evolution, owner=bug_submitter)
+ ... firefox_crashes, bug_submitter, evolution)
>>> notify(ObjectCreatedEvent(
... evolution_crashes_too, evolution_crashes_too.owner))
@@ -185,7 +184,7 @@
>>> trunk = evolution.getSeries('trunk')
>>> firefox_crashes_in_trunk = getUtility(IBugTaskSet).createTask(
- ... bug=firefox_crashes, productseries=trunk, owner=bug_submitter)
+ ... firefox_crashes, bug_submitter, trunk)
>>> notify(ObjectCreatedEvent(
... firefox_crashes_in_trunk, firefox_crashes_in_trunk.owner))
=== modified file 'lib/lp/bugs/doc/bugsubscription.txt'
--- lib/lp/bugs/doc/bugsubscription.txt 2011-07-20 17:08:24 +0000
+++ lib/lp/bugs/doc/bugsubscription.txt 2011-08-01 05:38:29 +0000
@@ -195,9 +195,7 @@
>>> from lp.registry.interfaces.product import IProductSet
>>> firefox = getUtility(IProductSet).get(4)
- >>> getUtility(IBugTaskSet).createTask(
- ... product=firefox, bug=linux_source_bug,
- ... owner=foobar)
+ >>> getUtility(IBugTaskSet).createTask(linux_source_bug, foobar, firefox)
<BugTask ...>
>>> lifeless = personset.getByName("lifeless")
@@ -749,7 +747,7 @@
supervisor will be subscribed:
>>> ubuntu_task = getUtility(IBugTaskSet).createTask(
- ... bug=new_bug, distribution=ubuntu, owner=mark)
+ ... new_bug, mark, ubuntu)
>>> print '\n'.join(getSubscribers(new_bug))
foo.bar@xxxxxxxxxxxxx
=== modified file 'lib/lp/bugs/doc/bugtask-expiration.txt'
--- lib/lp/bugs/doc/bugtask-expiration.txt 2011-06-29 08:57:14 +0000
+++ lib/lp/bugs/doc/bugtask-expiration.txt 2011-08-01 05:38:29 +0000
@@ -86,8 +86,7 @@
# An expirable bugtask, a distroseries. The ubuntu bugtask is its
# conjoined slave.
>>> hoary_bugtask = bugtaskset.createTask(
- ... bug=ubuntu_bugtask.bug, owner=sample_person,
- ... distroseries=ubuntu.currentseries)
+ ... ubuntu_bugtask.bug, sample_person, ubuntu.currentseries)
>>> ubuntu_bugtask.conjoined_master == hoary_bugtask
True
>>> ubuntu_bugtask.bug.permits_expiration
@@ -120,8 +119,7 @@
# This one's status is New.
>>> thunderbird = getUtility(IProductSet).getByName('thunderbird')
>>> new_bugtask = bugtaskset.createTask(
- ... bug=ubuntu_bugtask.bug, owner=sample_person,
- ... product=thunderbird)
+ ... ubuntu_bugtask.bug, sample_person, thunderbird)
>>> new_bugtask.status.title
'New'
>>> new_bugtask.bug.permits_expiration
@@ -145,9 +143,7 @@
>>> another_assigned_bugtask.transitionToTarget(ubuntu_alsa)
>>> ubuntu_evolution = ubuntu.getSourcePackage('evolution')
>>> invalid_bugtask = bugtaskset.createTask(
- ... bug=another_assigned_bugtask.bug, owner=sample_person,
- ... distribution=ubuntu,
- ... sourcepackagename=ubuntu_evolution.sourcepackagename,
+ ... another_assigned_bugtask.bug, sample_person, ubuntu_evolution,
... status=BugTaskStatus.INVALID)
>>> another_assigned_bugtask.bug.permits_expiration
True
=== modified file 'lib/lp/bugs/doc/bugtask-search.txt'
--- lib/lp/bugs/doc/bugtask-search.txt 2011-07-08 15:23:38 +0000
+++ lib/lp/bugs/doc/bugtask-search.txt 2011-08-01 05:38:29 +0000
@@ -304,9 +304,8 @@
>>> test_helper = BugTaskSearchBugsElsewhereTest(helper_only=True)
>>> bug_twelve = getUtility(IBugSet).get(12)
>>> task_open_upstream = bugtask_set.createTask(
- ... bug=bug_twelve, distribution=ubuntu, owner=foo_bar,
- ... status=BugTaskStatus.NEW,
- ... importance=BugTaskImportance.MEDIUM)
+ ... bug_twelve, foo_bar, ubuntu,
+ ... status=BugTaskStatus.NEW, importance=BugTaskImportance.MEDIUM)
>>> test_helper.assertBugTaskIsOpenUpstream(task_open_upstream)
Pass the resolved_upstream flag to include only bugtasks linked to
@@ -510,7 +509,7 @@
>>> firefox_1_0 = firefox.getSeries("1.0")
>>> productseries_task = bugtask_set.createTask(
- ... owner=no_priv, bug=bug_one, productseries=firefox_1_0)
+ ... bug_one, no_priv, firefox_1_0)
>>> productseries_task.milestone = product_milestone
>>> print bugTaskInfo(productseries_task)
40 1 Mozilla Firefox 1.0 Firefox does not support SVG
=== modified file 'lib/lp/bugs/doc/bugtask.txt'
--- lib/lp/bugs/doc/bugtask.txt 2011-07-27 08:04:46 +0000
+++ lib/lp/bugs/doc/bugtask.txt 2011-08-01 05:38:29 +0000
@@ -58,7 +58,7 @@
>>> evolution = productset.get(5)
>>> upstream_task = bugtaskset.createTask(
- ... bug=bug_one, product=evolution, owner=mark,
+ ... bug_one, mark, evolution,
... status=STATUS_NEW, importance=IMPORTANCE_MEDIUM)
>>> upstream_task.product == evolution
True
@@ -68,7 +68,7 @@
>>> ubuntu = distroset.get(1)
>>> a_distro = factory.makeDistribution(name='tubuntu')
>>> distro_task = bugtaskset.createTask(
- ... bug=bug_one, distribution=a_distro, owner=mark,
+ ... bug_one, mark, a_distro,
... status=STATUS_NEW, importance=IMPORTANCE_MEDIUM)
>>> distro_task.distribution == a_distro
True
@@ -78,7 +78,7 @@
>>> warty = distoseriesset.get(1)
>>> distro_series_task = bugtaskset.createTask(
- ... bug=bug_one, distroseries=warty, owner=mark,
+ ... bug_one, mark, warty,
... status=STATUS_NEW, importance=IMPORTANCE_MEDIUM)
>>> distro_series_task.distroseries == warty
True
@@ -107,8 +107,7 @@
>>> firefox = productset['firefox']
>>> firefox_1_0 = firefox.getSeries("1.0")
- >>> productseries_task = bugtaskset.createTask(
- ... owner=mark, bug=bug_one, productseries=firefox_1_0)
+ >>> productseries_task = bugtaskset.createTask(bug_one, mark, firefox_1_0)
>>> productseries_task.target == firefox_1_0
True
@@ -325,13 +324,11 @@
... BugTaskImportance.CRITICAL, ubuntu.owner)
>>> current_series_ubuntu_task = bugtaskset.createTask(
- ... bug=ubuntu_bug, owner=launchbag.user,
- ... distroseries=ubuntu.currentseries)
+ ... ubuntu_bug, launchbag.user, ubuntu.currentseries)
>>> current_series_netapplet_task = bugtaskset.createTask(
- ... bug=ubuntu_netapplet_bug, owner=launchbag.user,
- ... distroseries=ubuntu.currentseries,
- ... sourcepackagename=ubuntu_netapplet.sourcepackagename)
+ ... ubuntu_netapplet_bug, launchbag.user,
+ ... ubuntu_netapplet.development_version)
(The attributes were synched with the generic task.)
@@ -368,12 +365,11 @@
trunk
>>> generic_alsa_utils_task = bugtaskset.createTask(
- ... bug=ubuntu_netapplet_bug, owner=launchbag.user,
- ... product=alsa_utils)
+ ... ubuntu_netapplet_bug, launchbag.user, alsa_utils)
>>> devel_focus_alsa_utils_task = bugtaskset.createTask(
- ... bug=ubuntu_netapplet_bug, owner=launchbag.user,
- ... productseries=alsa_utils.getSeries("trunk"))
+ ... ubuntu_netapplet_bug, launchbag.user,
+ ... alsa_utils.getSeries("trunk"))
A conjoined bugtask involves a master and slave in the conjoined
relationship. The slave is the generic product or distribution task; the
@@ -429,8 +425,7 @@
>>> alsa_utils.development_focus == alsa_utils_stable
False
>>> stable_netapplet_task = bugtaskset.createTask(
- ... bug=ubuntu_netapplet_bug, owner=launchbag.user,
- ... productseries=alsa_utils_stable)
+ ... ubuntu_netapplet_bug, launchbag.user, alsa_utils_stable)
>>> stable_netapplet_task.conjoined_master is None
True
>>> stable_netapplet_task.conjoined_slave is None
@@ -440,9 +435,8 @@
>>> warty == ubuntu.currentseries
False
>>> warty_netapplet_task = bugtaskset.createTask(
- ... bug=ubuntu_netapplet_bug, owner=launchbag.user,
- ... distroseries=warty,
- ... sourcepackagename=ubuntu_netapplet.sourcepackagename)
+ ... ubuntu_netapplet_bug, launchbag.user,
+ ... warty.getSourcePackage(ubuntu_netapplet.sourcepackagename))
>>> warty_netapplet_task.conjoined_master is None
True
>>> warty_netapplet_task.conjoined_slave is None
@@ -456,9 +450,8 @@
True
>>> gentoo_netapplet_task = bugtaskset.createTask(
- ... bug=ubuntu_netapplet_bug, owner=launchbag.user,
- ... distribution=gentoo,
- ... sourcepackagename=ubuntu_netapplet.sourcepackagename)
+ ... ubuntu_netapplet_bug, launchbag.user,
+ ... gentoo.getSourcePackage(ubuntu_netapplet.sourcepackagename))
>>> gentoo_netapplet_task.conjoined_master is None
True
>>> gentoo_netapplet_task.conjoined_slave is None
@@ -965,7 +958,7 @@
>>> netapplet = productset.get(11)
>>> upstream_task = bugtaskset.createTask(
- ... bug=bug_one, product=netapplet, owner=mark,
+ ... bug_one, mark, netapplet,
... status=STATUS_NEW, importance=IMPORTANCE_MEDIUM)
>>> upstream_task.bugtargetdisplayname
u'NetApplet'
@@ -1031,10 +1024,7 @@
0
>>> bugtaskset.createTask(
- ... bug=new_bug, owner=mark,
- ... distribution=ubuntu,
- ... sourcepackagename=(
- ... sourcepackagenameset.queryByName('mozilla-firefox')))
+ ... new_bug, mark, ubuntu.getSourcePackage('mozilla-firefox'))
<BugTask ...>
>>> new_bug.addNomination(mark, ubuntu.currentseries).approve(mark)
@@ -1047,10 +1037,7 @@
mozilla-firefox (Ubuntu Hoary)
>>> bugtaskset.createTask(
- ... bug=new_bug, owner=mark,
- ... distribution=ubuntu,
- ... sourcepackagename=(
- ... sourcepackagenameset.queryByName('alsa-utils')))
+ ... new_bug, mark, ubuntu.getSourcePackage('alsa-utils'))
<BugTask ...>
The second task has been created and has also been successfully
=== modified file 'lib/lp/bugs/doc/bugwatch.txt'
--- lib/lp/bugs/doc/bugwatch.txt 2010-12-22 20:46:21 +0000
+++ lib/lp/bugs/doc/bugwatch.txt 2011-08-01 05:38:29 +0000
@@ -433,9 +433,7 @@
... comment="A sample bug for conjoined master tests."))
>>> targeted_bugtask = getUtility(IBugTaskSet).createTask(
- ... bug=bug, owner=sample_person,
- ... distroseries=ubuntu.currentseries,
- ... sourcepackagename=firefox.sourcepackagename)
+ ... bug, sample_person, firefox.development_version)
>>> targeted_bugtask.conjoined_master is None
True
=== modified file 'lib/lp/bugs/doc/distribution-upstream-bug-report.txt'
--- lib/lp/bugs/doc/distribution-upstream-bug-report.txt 2011-06-29 09:25:32 +0000
+++ lib/lp/bugs/doc/distribution-upstream-bug-report.txt 2011-08-01 05:38:29 +0000
@@ -127,7 +127,7 @@
We then add an upstream task to the second pmount bug:
- >>> task = getUtility(IBugTaskSet).createTask(bug, name12, product=pmount)
+ >>> task = getUtility(IBugTaskSet).createTask(bug, name12, pmount)
>>> Store.of(task).flush()
>>> print_report(ubuntu.getPackagesAndPublicUpstreamBugCounts(limit=3))
pmount pmount 2 2 1 0 0
=== modified file 'lib/lp/bugs/doc/malone-karma.txt'
--- lib/lp/bugs/doc/malone-karma.txt 2011-07-21 07:11:09 +0000
+++ lib/lp/bugs/doc/malone-karma.txt 2011-08-01 05:38:29 +0000
@@ -158,7 +158,7 @@
>>> from lp.registry.interfaces.product import IProductSet
>>> evolution = getUtility(IProductSet)['evolution']
>>> evolution_task = getUtility(IBugTaskSet).createTask(
- ... bug, product=evolution, owner=foo_bar)
+ ... bug, foo_bar, evolution)
>>> notify(ObjectCreatedEvent(evolution_task))
Karma added: action=bugtaskcreated, product=evolution
@@ -166,7 +166,7 @@
>>> evolution_trunk = evolution.getSeries('trunk')
>>> evolution_trunk_task = getUtility(IBugTaskSet).createTask(
- ... bug, productseries=evolution_trunk, owner=foo_bar)
+ ... bug, foo_bar, evolution_trunk)
>>> notify(ObjectCreatedEvent(evolution_trunk_task))
Karma added: action=bugtaskcreated, product=evolution
@@ -174,7 +174,7 @@
>>> debian_woody = debian.getSeries("woody")
>>> debian_woody_task = getUtility(IBugTaskSet).createTask(
- ... bug, distroseries=debian_woody, owner=foo_bar)
+ ... bug, foo_bar, debian_woody)
>>> notify(ObjectCreatedEvent(debian_woody_task))
Karma added: action=bugtaskcreated, distribution=debian
=== modified file 'lib/lp/bugs/doc/security-teams.txt'
--- lib/lp/bugs/doc/security-teams.txt 2011-07-27 08:04:46 +0000
+++ lib/lp/bugs/doc/security-teams.txt 2011-08-01 05:38:29 +0000
@@ -175,8 +175,7 @@
name16
>>> bugtaskset = getUtility(IBugTaskSet)
- >>> bug_in_evolution = bugtaskset.createTask(
- ... bug=bug, product=evolution, owner=foobar)
+ >>> bug_in_evolution = bugtaskset.createTask(bug, foobar, evolution)
lifeless is subscribed to the public security bug when a task is added
for evolution.
@@ -203,8 +202,7 @@
>>> subscriber_names(bug)
[u'name12', u'name16']
- >>> bug_in_evolution = bugtaskset.createTask(
- ... bug=bug, product=evolution, owner=foobar)
+ >>> bug_in_evolution = bugtaskset.createTask(bug, foobar, evolution)
>>> subscriber_names(bug)
[u'name12', u'name16']
=== modified file 'lib/lp/bugs/interfaces/bugtask.py'
--- lib/lp/bugs/interfaces/bugtask.py 2011-07-27 03:58:17 +0000
+++ lib/lp/bugs/interfaces/bugtask.py 2011-08-01 05:38:29 +0000
@@ -1508,10 +1508,8 @@
:return: A list of tuples containing (status_id, count).
"""
- def createTask(bug, product=None, productseries=None, distribution=None,
- distroseries=None, sourcepackagename=None, status=None,
- importance=None, assignee=None, owner=None,
- milestone=None):
+ def createTask(bug, owner, target, status=None, importance=None,
+ assignee=None, milestone=None):
"""Create a bug task on a bug and return it.
If the bug is public, bug supervisors will be automatically
@@ -1519,8 +1517,6 @@
If the bug has any accepted series nominations for a supplied
distribution, series tasks will be created for them.
-
- Exactly one of product, distribution or distroseries must be provided.
"""
def findExpirableBugTasks(min_days_old, user, bug=None, target=None,
=== modified file 'lib/lp/bugs/model/bug.py'
--- lib/lp/bugs/model/bug.py 2011-07-29 18:49:10 +0000
+++ lib/lp/bugs/model/bug.py 2011-08-01 05:38:29 +0000
@@ -167,6 +167,7 @@
from lp.bugs.model.bugtarget import OfficialBugTag
from lp.bugs.model.bugtask import (
BugTask,
+ bug_target_to_key,
bugtask_sort_key,
)
from lp.bugs.model.bugwatch import BugWatch
@@ -1183,33 +1184,7 @@
def addTask(self, owner, target):
"""See `IBug`."""
- product = None
- product_series = None
- distribution = None
- distro_series = None
- source_package_name = None
-
- # Turn `target` into something more useful.
- if IProduct.providedBy(target):
- product = target
- if IProductSeries.providedBy(target):
- product_series = target
- if IDistribution.providedBy(target):
- distribution = target
- if IDistroSeries.providedBy(target):
- distro_series = target
- if IDistributionSourcePackage.providedBy(target):
- distribution = target.distribution
- source_package_name = target.sourcepackagename
- if ISourcePackage.providedBy(target):
- distro_series = target.distroseries
- source_package_name = target.sourcepackagename
-
- new_task = getUtility(IBugTaskSet).createTask(
- self, owner=owner, product=product,
- productseries=product_series, distribution=distribution,
- distroseries=distro_series,
- sourcepackagename=source_package_name)
+ new_task = getUtility(IBugTaskSet).createTask(self, owner, target)
# When a new task is added the bug's heat becomes relevant to the
# target's max_bug_heat.
@@ -2531,15 +2506,15 @@
# Create the task on a product if one was passed.
if params.product:
getUtility(IBugTaskSet).createTask(
- bug=bug, product=params.product, owner=params.owner,
- status=params.status)
+ bug, params.owner, params.product, status=params.status)
# Create the task on a source package name if one was passed.
if params.distribution:
+ target = params.distribution
+ if params.sourcepackagename:
+ target = target.getSourcePackage(params.sourcepackagename)
getUtility(IBugTaskSet).createTask(
- bug=bug, distribution=params.distribution,
- sourcepackagename=params.sourcepackagename,
- owner=params.owner, status=params.status)
+ bug, params.owner, target, status=params.status)
bug_task = bug.default_bugtask
if params.assignee:
=== modified file 'lib/lp/bugs/model/bugtask.py'
--- lib/lp/bugs/model/bugtask.py 2011-07-27 04:34:19 +0000
+++ lib/lp/bugs/model/bugtask.py 2011-08-01 05:38:29 +0000
@@ -2697,9 +2697,7 @@
omit_dupes=True, exclude_conjoined_tasks=True)
return self.search(params)
- def createTask(self, bug, owner, product=None, productseries=None,
- distribution=None, distroseries=None,
- sourcepackagename=None,
+ def createTask(self, bug, owner, target,
status=IBugTask['status'].default,
importance=IBugTask['importance'].default,
assignee=None, milestone=None):
@@ -2713,55 +2711,20 @@
if not milestone:
milestone = None
- # Raise a WidgetError if this product bugtask already exists.
- target = None
- stop_checking = False
- if sourcepackagename is not None:
- # A source package takes precedence over the distro series
- # or distribution in which the source package is found.
- if distroseries is not None:
- # We'll need to make sure there's no bug task already
- # filed against this source package in this
- # distribution series.
- target = distroseries.getSourcePackage(sourcepackagename)
- elif distribution is not None:
- # Make sure there's no bug task already filed against
- # this source package in this distribution.
- validate_new_target(
- bug, distribution.getSourcePackage(sourcepackagename))
- stop_checking = True
-
- if target is None and not stop_checking:
- # This task is not being filed against a source package. Find
- # the prospective target.
- if productseries is not None:
- # Bug filed against a product series.
- target = productseries
- elif product is not None:
- # Bug filed against a product.
- target = product
- elif distroseries is not None:
- # Bug filed against a distro series.
- target = distroseries
- elif distribution is not None and not stop_checking:
- # Bug filed against a distribution.
- validate_new_target(bug, distribution)
- stop_checking = True
-
- if target is not None and not stop_checking:
- # Make sure there's no task for this bug already filed
- # against the target.
- validate_target(bug, target)
+ # Make sure there's no task for this bug already filed
+ # against the target.
+ validate_new_target(bug, target)
+
+ target_key = bug_target_to_key(target)
if not bug.private and bug.security_related:
+ product = target_key['product']
+ distribution = target_key['distribution']
if product and product.security_contact:
bug.subscribe(product.security_contact, owner)
elif distribution and distribution.security_contact:
bug.subscribe(distribution.security_contact, owner)
- assert (product or productseries or distribution or distroseries), (
- 'Got no bugtask target.')
-
non_target_create_params = dict(
bug=bug,
status=status,
@@ -2769,24 +2732,21 @@
assignee=assignee,
owner=owner,
milestone=milestone)
- bugtask = BugTask(
- product=product,
- productseries=productseries,
- distribution=distribution,
- distroseries=distroseries,
- sourcepackagename=sourcepackagename,
- **non_target_create_params)
+ create_params = non_target_create_params.copy()
+ create_params.update(target_key)
+ bugtask = BugTask(**create_params)
- if distribution:
+ if target_key['distribution']:
# Create tasks for accepted nominations if this is a source
# package addition.
accepted_nominations = [
- nomination for nomination in bug.getNominations(distribution)
+ nomination for nomination in
+ bug.getNominations(target_key['distribution'])
if nomination.isApproved()]
for nomination in accepted_nominations:
accepted_series_task = BugTask(
distroseries=nomination.distroseries,
- sourcepackagename=sourcepackagename,
+ sourcepackagename=target_key['sourcepackagename'],
**non_target_create_params)
accepted_series_task.updateTargetNameCache()
=== modified file 'lib/lp/bugs/model/tests/test_bugtask.py'
--- lib/lp/bugs/model/tests/test_bugtask.py 2011-07-27 08:04:46 +0000
+++ lib/lp/bugs/model/tests/test_bugtask.py 2011-08-01 05:38:29 +0000
@@ -1247,14 +1247,12 @@
create_old_bug("90 days old", 90, self.distribution))
bugtasks.append(
self.bugtaskset.createTask(
- bug=bugtasks[-1].bug, owner=self.user,
- distroseries=self.distroseries))
+ bugtasks[-1].bug, self.user, self.distroseries))
bugtasks.append(
create_old_bug("90 days old", 90, self.product))
bugtasks.append(
self.bugtaskset.createTask(
- bug=bugtasks[-1].bug, owner=self.user,
- productseries=self.productseries))
+ bugtasks[-1].bug, self.user, self.productseries))
def tearDown(self):
logout()
=== modified file 'lib/lp/bugs/scripts/bugzilla.py'
--- lib/lp/bugs/scripts/bugzilla.py 2011-06-14 20:35:20 +0000
+++ lib/lp/bugs/scripts/bugzilla.py 2011-08-01 05:38:29 +0000
@@ -534,11 +534,11 @@
if re.match(r'^deb\d+$', bug.alias):
watch = self.bugwatchset.createBugWatch(
lp_bug, lp_bug.owner, self.debbugs, bug.alias[3:])
+ target = self.debian
+ if target['sourcepackagename']:
+ target.getSourcePackage(target['sourcepackagename'])
debtask = self.bugtaskset.createTask(
- lp_bug,
- owner=lp_bug.owner,
- distribution=self.debian,
- sourcepackagename=target['sourcepackagename'])
+ lp_bug, lp_bug.owner, target)
debtask.datecreated = bug.creation_ts
debtask.bugwatch = watch
else:
@@ -560,7 +560,7 @@
if len(watches) > 0:
if product:
upstreamtask = self.bugtaskset.createTask(
- lp_bug, product=product, owner=lp_bug.owner)
+ lp_bug, lp_bug.owner, product)
upstreamtask.datecreated = bug.creation_ts
upstreamtask.bugwatch = watches[0]
else:
=== modified file 'lib/lp/bugs/scripts/checkwatches/tests/test_core.py'
--- lib/lp/bugs/scripts/checkwatches/tests/test_core.py 2011-05-27 21:12:25 +0000
+++ lib/lp/bugs/scripts/checkwatches/tests/test_core.py 2011-08-01 05:38:29 +0000
@@ -316,7 +316,7 @@
bugtracker = new_bugtracker(BugTrackerType.ROUNDUP)
self.bugtask_with_question = getUtility(IBugTaskSet).createTask(
bug_with_question, sample_person,
- product=getUtility(IProductSet).getByName('firefox'))
+ getUtility(IProductSet).getByName('firefox'))
self.bugwatch_with_question = bug_with_question.addWatch(
bugtracker, '1', getUtility(ILaunchpadCelebrities).janitor)
self.bugtask_with_question.bugwatch = self.bugwatch_with_question
=== modified file 'lib/lp/bugs/scripts/importdebianbugs.py'
--- lib/lp/bugs/scripts/importdebianbugs.py 2011-05-27 21:12:25 +0000
+++ lib/lp/bugs/scripts/importdebianbugs.py 2011-08-01 05:38:29 +0000
@@ -36,10 +36,11 @@
[debian_task] = bug.bugtasks
bug_watch_updater.updateBugWatches(
external_debbugs, [debian_task.bugwatch])
+ target = getUtility(ILaunchpadCelebrities).ubuntu
+ if debian_task.sourcepackagename:
+ target = target.getSourcePackage(debian_task.sourcepackagename)
getUtility(IBugTaskSet).createTask(
- bug, getUtility(ILaunchpadCelebrities).bug_watch_updater,
- distribution=getUtility(ILaunchpadCelebrities).ubuntu,
- sourcepackagename=debian_task.sourcepackagename)
+ bug, getUtility(ILaunchpadCelebrities).bug_watch_updater, target)
log.info(
"Imported debbugs #%s as Launchpad bug #%s." % (
debian_bug, bug.id))
=== modified file 'lib/lp/bugs/tests/bug.py'
--- lib/lp/bugs/tests/bug.py 2011-07-19 10:17:47 +0000
+++ lib/lp/bugs/tests/bug.py 2011-08-01 05:38:29 +0000
@@ -156,7 +156,7 @@
bug = getUtility(IBugSet).get(bug)
product = getUtility(IProductSet).getByName(product)
owner = getUtility(IPersonSet).getByName(owner)
- task = getUtility(IBugTaskSet).createTask(bug, owner, product=product)
+ task = getUtility(IBugTaskSet).createTask(bug, owner, product)
if watchurl:
[watch] = getUtility(IBugWatchSet).fromText(watchurl, bug, owner)
task.bugwatch = watch
=== modified file 'lib/lp/bugs/tests/test_bugtarget.py'
--- lib/lp/bugs/tests/test_bugtarget.py 2011-06-20 07:04:11 +0000
+++ lib/lp/bugs/tests/test_bugtarget.py 2011-08-01 05:38:29 +0000
@@ -93,8 +93,7 @@
"""
bug = bugtarget_filebug(productseries.product, summary, status=status)
getUtility(IBugTaskSet).createTask(
- bug, getUtility(ILaunchBag).user, productseries=productseries,
- status=status)
+ bug, getUtility(ILaunchBag).user, productseries, status=status)
return bug
@@ -132,10 +131,12 @@
first be filed on its distribution, and then a series task will be
added.
"""
+ target = distroseries
+ if sourcepackagename:
+ target = target.getSourcePackage(sourcepackagename)
bug = bugtarget_filebug(distroseries.distribution, summary, status=status)
getUtility(IBugTaskSet).createTask(
- bug, getUtility(ILaunchBag).user, distroseries=distroseries,
- sourcepackagename=sourcepackagename, status=status)
+ bug, getUtility(ILaunchBag).user, target, status=status)
return bug
=== modified file 'lib/lp/registry/browser/tests/test_milestone.py'
--- lib/lp/registry/browser/tests/test_milestone.py 2011-07-26 00:58:59 +0000
+++ lib/lp/registry/browser/tests/test_milestone.py 2011-08-01 05:38:29 +0000
@@ -161,7 +161,7 @@
product = self.factory.makeProduct()
bug = self.factory.makeBug(product=product)
master_bugtask = getUtility(IBugTaskSet).createTask(
- bug, productseries=product.development_focus, owner=product.owner)
+ bug, product.owner, product.development_focus)
milestone = self.factory.makeMilestone(
productseries=product.development_focus)
login_person(product.owner)
=== modified file 'lib/lp/registry/tests/test_project_milestone.py'
--- lib/lp/registry/tests/test_project_milestone.py 2011-06-28 15:04:29 +0000
+++ lib/lp/registry/tests/test_project_milestone.py 2011-08-01 05:38:29 +0000
@@ -263,8 +263,7 @@
owner=sample_person,
status=BugTaskStatus.CONFIRMED)
bug = product.createBug(params)
- getUtility(IBugTaskSet).createTask(bug, owner=sample_person,
- productseries=series)
+ getUtility(IBugTaskSet).createTask(bug, sample_person, series)
for bugtask in bug.bugtasks:
if bugtask.productseries is not None:
bugtask.milestone = milestone
=== modified file 'lib/lp/soyuz/scripts/tests/test_queue.py'
--- lib/lp/soyuz/scripts/tests/test_queue.py 2011-07-07 16:05:03 +0000
+++ lib/lp/soyuz/scripts/tests/test_queue.py 2011-08-01 05:38:29 +0000
@@ -365,8 +365,7 @@
ubuntu_bar = ubuntu.getSourcePackage('bar')
the_bug = getUtility(IBugSet).get(the_bug_id)
bugtask = getUtility(IBugTaskSet).createTask(
- bug=the_bug, owner=bugtask_owner, distribution=ubuntu,
- sourcepackagename=ubuntu_bar.sourcepackagename)
+ the_bug, bugtask_owner, ubuntu_bar)
LaunchpadZopelessLayer.txn.commit()
LaunchpadZopelessLayer.switchDbUser(self.dbuser)