Merge lp:~stevenk/launchpad/derivedistroseries-qafail-again into lp:launchpad

Proposed by Steve Kowalik
Status: Merged
Approved by: Steve Kowalik
Approved revision: no longer in the source branch.
Merged at revision: 11867
Proposed branch: lp:~stevenk/launchpad/derivedistroseries-qafail-again
Merge into: lp:launchpad
Diff against target: 97 lines (+10/-13)
4 files modified
lib/canonical/launchpad/interfaces/_schema_circular_imports.py (+1/-1)
lib/lp/registry/interfaces/distroseries.py (+1/-5)
lib/lp/registry/model/distroseries.py (+1/-3)
lib/lp/registry/stories/webservice/xx-derivedistroseries.txt (+7/-4)
To merge this branch: bzr merge lp:~stevenk/launchpad/derivedistroseries-qafail-again
Reviewer Review Type Date Requested Status
Gavin Panella (community) Approve
Review via email: mp+40054@code.launchpad.net

Commit message

Remove status from IDistroSeries.deriveDistroSeries(), and actually have distribution be an IDistribution.

Description of the change

Fix a stupid thinko in the circular imports for deriveDistroSeries()

Also, remove status, since it's pointless, callers can't iterate over any objects in the API for the different states, and you need launchpad.Moderate permission to set it.

Fix the API tests to exercise how I was planning to QA it, by creating a new series.

To post a comment you must log in.
Revision history for this message
Gavin Panella (allenap) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/interfaces/_schema_circular_imports.py'
2--- lib/canonical/launchpad/interfaces/_schema_circular_imports.py 2010-11-02 05:48:54 +0000
3+++ lib/canonical/launchpad/interfaces/_schema_circular_imports.py 2010-11-04 07:44:43 +0000
4@@ -379,7 +379,7 @@
5 IDistroSeries, 'getPackageUploads', IPackageUpload)
6 patch_reference_property(IDistroSeries, 'parent_series', IDistroSeries)
7 patch_plain_parameter_type(
8- IDistroSeries, 'deriveDistroSeries', 'distribution', IDistroSeries)
9+ IDistroSeries, 'deriveDistroSeries', 'distribution', IDistribution)
10
11 # IDistroSeriesDifferenceComment
12 IDistroSeriesDifferenceComment['comment_author'].schema = IPerson
13
14=== modified file 'lib/lp/registry/interfaces/distroseries.py'
15--- lib/lp/registry/interfaces/distroseries.py 2010-11-02 06:21:58 +0000
16+++ lib/lp/registry/interfaces/distroseries.py 2010-11-04 07:44:43 +0000
17@@ -810,7 +810,6 @@
18 description=copy_field(description, required=False),
19 version=copy_field(version, required=False),
20 distribution=copy_field(distribution, required=False),
21- status=copy_field(status, required=False),
22 architectures=List(
23 title=_("The list of architectures to copy to the derived "
24 "distroseries."), value_type=TextLine(),
25@@ -827,7 +826,7 @@
26 @call_with(user=REQUEST_USER)
27 @export_write_operation()
28 def deriveDistroSeries(user, name, displayname, title, summary,
29- description, version, distribution, status,
30+ description, version, distribution,
31 architectures, packagesets, rebuild):
32 """Derive a distroseries from this one.
33
34@@ -851,9 +850,6 @@
35 :param distribution: The distribution the derived series will
36 belong to. If it isn't specified this distroseries'
37 distribution is used.
38- :param status: The status the new distroseries will be created
39- in. If the distroseries isn't specified, this parameter will
40- be ignored. Defaults to FROZEN.
41 :param architectures: The architectures to copy to the derived
42 series. If not specified, all of the architectures are copied.
43 :param packagesets: The packagesets to copy to the derived series.
44
45=== modified file 'lib/lp/registry/model/distroseries.py'
46--- lib/lp/registry/model/distroseries.py 2010-11-03 17:47:52 +0000
47+++ lib/lp/registry/model/distroseries.py 2010-11-04 07:44:43 +0000
48@@ -1890,8 +1890,7 @@
49 def deriveDistroSeries(self, user, name, distribution=None,
50 displayname=None, title=None, summary=None,
51 description=None, version=None,
52- status=SeriesStatus.FROZEN, architectures=(),
53- packagesets=(), rebuild=False):
54+ architectures=(), packagesets=(), rebuild=False):
55 """See `IDistroSeries`."""
56 # XXX StevenK bug=643369 This should be in the security adapter
57 # This should be allowed if the user is a driver for self.parent
58@@ -1925,7 +1924,6 @@
59 name=name, displayname=displayname, title=title,
60 summary=summary, description=description,
61 version=version, parent_series=self, owner=user)
62- child.status = status
63 IStore(self).add(child)
64 else:
65 if child.parent_series is not self:
66
67=== modified file 'lib/lp/registry/stories/webservice/xx-derivedistroseries.txt'
68--- lib/lp/registry/stories/webservice/xx-derivedistroseries.txt 2010-10-28 19:46:28 +0000
69+++ lib/lp/registry/stories/webservice/xx-derivedistroseries.txt 2010-11-04 07:44:43 +0000
70@@ -13,9 +13,9 @@
71 >>> soyuz = factory.makeTeam(name='soyuz-team')
72 >>> parent = factory.makeDistroSeries()
73 >>> child = factory.makeDistroSeries(name='child1', parent_series=parent)
74- >>> second_child = factory.makeDistroSeries(name='child2',
75- ... parent_series=parent)
76 >>> other = factory.makeDistroSeries()
77+ >>> distribution = factory.makeDistribution(name='deribuntu', owner=soyuz)
78+ >>> version = "%s.0" % factory.getUniqueInteger()
79 >>> logout()
80 >>> from canonical.launchpad.testing.pages import webservice_for_person
81 >>> from canonical.launchpad.webapp.interfaces import OAuthPermission
82@@ -60,10 +60,13 @@
83
84 If we call it with all of the arguments, it also works.
85
86- >>> child_name = second_child.name
87+ >>> deribuntu = webservice.get('/deribuntu').jsonBody()
88+ >>> text = 'The Second Child'
89 >>> derived = soyuz_webservice.named_post(
90 ... series['self_link'], 'deriveDistroSeries', {},
91- ... name=child_name, architectures=('i386',),
92+ ... name='child2', displayname=text, title=text, summary=text,
93+ ... description=text, version=version,
94+ ... distribution=deribuntu['self_link'], architectures=('i386',),
95 ... packagesets=('test1',), rebuild=False)
96 >>> print derived
97 HTTP/1.1 200 Ok