Merge lp:~bac/launchpad/bug-524778-2 into lp:launchpad

Proposed by Brad Crittenden
Status: Merged
Approved by: Eleanor Berger
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~bac/launchpad/bug-524778-2
Merge into: lp:launchpad
Diff against target: 27 lines (+5/-5)
1 file modified
lib/lp/registry/interfaces/milestone.py (+5/-5)
To merge this branch: bzr merge lp:~bac/launchpad/bug-524778-2
Reviewer Review Type Date Requested Status
Eleanor Berger (community) Approve
Review via email: mp+24060@code.launchpad.net

Commit message

Fix the export of Milestone delete to use @export_destructor_operation.

Description of the change

= Summary =

The milestone 'destroySelf' method was exported as a write operation
which causes an unnecessary NotFound exception to be raised after the
successful deletion. It should've been exported as a destructor.

== Proposed fix ==

Change to use @export_destructor_operation

== Pre-implementation notes ==

Talks with Curtis, Leondard, and Francis.

== Implementation details ==

As above.

== Tests ==

There are currently no launchpadlib automated tests. The method can be
tested interactively using the following:

In [1]: from launchpadlib.launchpad import Launchpad
In [2]: lp = Launchpad.login_with('interactive', service_root='dev')
In [3]: ff = lp.projects['firefox']
In [4]: ff.getMilestone(name='deleteme') # None found.
In [5]: series = ff.series[0]
In [6]: nm = series.newMilestone(name='deleteme')
In [7]: ff.getMilestone(name='deleteme')
Out[7]: <milestone at
https://api.launchpad.dev/1.0/firefox/+milestone/deleteme>
In [8]: nm._root._browser.delete(nm.self_link)
In [9]: ff.getMilestone(name='deleteme') # None found.

== Demo and Q/A ==

As above against staging or edge.

= Launchpad lint =

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  lib/lp/registry/interfaces/milestone.py

To post a comment you must log in.
Revision history for this message
Eleanor Berger (intellectronica) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/registry/interfaces/milestone.py'
2--- lib/lp/registry/interfaces/milestone.py 2010-02-27 10:19:18 +0000
3+++ lib/lp/registry/interfaces/milestone.py 2010-04-27 10:40:56 +0000
4@@ -32,10 +32,10 @@
5
6 from lazr.restful.fields import CollectionField, Reference
7 from lazr.restful.declarations import (
8- call_with, export_as_webservice_entry, export_factory_operation, exported,
9- export_operation_as, export_read_operation, export_write_operation,
10- operation_parameters, operation_returns_entry, rename_parameters_as,
11- REQUEST_USER)
12+ call_with, export_as_webservice_entry, export_destructor_operation,
13+ export_factory_operation, exported, export_operation_as,
14+ export_read_operation, operation_parameters, operation_returns_entry,
15+ rename_parameters_as, REQUEST_USER)
16
17
18 class MilestoneNameField(ContentNameField):
19@@ -173,7 +173,7 @@
20 XXX sinzui 2010-01-27 bug=341687: blueprints not yet implemented.
21 """
22
23- @export_write_operation()
24+ @export_destructor_operation()
25 @export_operation_as('delete')
26 def destroySelf():
27 """Delete this milestone.