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
=== modified file 'lib/lp/registry/interfaces/milestone.py'
--- lib/lp/registry/interfaces/milestone.py 2010-02-27 10:19:18 +0000
+++ lib/lp/registry/interfaces/milestone.py 2010-04-27 10:40:56 +0000
@@ -32,10 +32,10 @@
3232
33from lazr.restful.fields import CollectionField, Reference33from lazr.restful.fields import CollectionField, Reference
34from lazr.restful.declarations import (34from lazr.restful.declarations import (
35 call_with, export_as_webservice_entry, export_factory_operation, exported,35 call_with, export_as_webservice_entry, export_destructor_operation,
36 export_operation_as, export_read_operation, export_write_operation,36 export_factory_operation, exported, export_operation_as,
37 operation_parameters, operation_returns_entry, rename_parameters_as,37 export_read_operation, operation_parameters, operation_returns_entry,
38 REQUEST_USER)38 rename_parameters_as, REQUEST_USER)
3939
4040
41class MilestoneNameField(ContentNameField):41class MilestoneNameField(ContentNameField):
@@ -173,7 +173,7 @@
173 XXX sinzui 2010-01-27 bug=341687: blueprints not yet implemented.173 XXX sinzui 2010-01-27 bug=341687: blueprints not yet implemented.
174 """174 """
175175
176 @export_write_operation()176 @export_destructor_operation()
177 @export_operation_as('delete')177 @export_operation_as('delete')
178 def destroySelf():178 def destroySelf():
179 """Delete this milestone.179 """Delete this milestone.