Merge lp:~jelmer/launchpad/bug371693 into lp:launchpad/db-devel

Proposed by Jelmer Vernooij
Status: Merged
Merged at revision: not available
Proposed branch: lp:~jelmer/launchpad/bug371693
Merge into: lp:launchpad/db-devel
Prerequisite: lp:~jelmer/launchpad/requestdeletion-rt
Diff against target: 74 lines (+36/-4)
2 files modified
lib/lp/soyuz/interfaces/publishing.py (+6/-3)
lib/lp/soyuz/stories/webservice/xx-source-package-publishing.txt (+30/-1)
To merge this branch: bzr merge lp:~jelmer/launchpad/bug371693
Reviewer Review Type Date Requested Status
Abel Deuring (community) code Approve
Review via email: mp+15942@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

= Summary =
Export IPublishing.requestDeletion() as web API. (bug371693)

== Proposed fix ==

== Pre-implementation notes ==

== Implementation details ==

== Tests ==

./bin/test -ct xx-source-package-publishing

== Demo and Q/A ==

Revision history for this message
Abel Deuring (adeuring) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/soyuz/interfaces/publishing.py'
2--- lib/lp/soyuz/interfaces/publishing.py 2009-12-10 13:38:23 +0000
3+++ lib/lp/soyuz/interfaces/publishing.py 2009-12-10 13:38:26 +0000
4@@ -39,9 +39,8 @@
5
6 from lazr.restful.fields import Reference
7 from lazr.restful.declarations import (
8- export_as_webservice_entry, export_read_operation, exported,
9- operation_returns_collection_of)
10-
11+ export_as_webservice_entry, export_read_operation, export_write_operation,
12+ exported, operation_parameters, operation_returns_collection_of)
13
14 #
15 # Exceptions
16@@ -283,6 +282,10 @@
17 `IBinaryPackagePublishingHistory`.
18 """
19
20+ @operation_parameters(
21+ removed_by=Reference(schema=IPerson, title=_("Removed by")),
22+ removal_comment=TextLine(title=_("Removal comment"), required=False))
23+ @export_write_operation()
24 def requestDeletion(removed_by, removal_comment=None):
25 """Delete this publication.
26
27
28=== modified file 'lib/lp/soyuz/stories/webservice/xx-source-package-publishing.txt'
29--- lib/lp/soyuz/stories/webservice/xx-source-package-publishing.txt 2009-12-07 14:47:54 +0000
30+++ lib/lp/soyuz/stories/webservice/xx-source-package-publishing.txt 2009-12-10 13:38:26 +0000
31@@ -38,7 +38,7 @@
32 iceweasel 1.0 in warty
33 pmount 0.1-1 in warty
34
35-getPublishedSources() can accept some optional filtering paramters to reduce
36+getPublishedSources() can accept some optional filtering parameters to reduce
37 the number of returned publications.
38
39 Search by name and version using an exact match:
40@@ -162,6 +162,35 @@
41 >>> print pubs['entries'][0]['package_signer_link']
42 None
43
44+Package deletion
45+================
46+
47+A user can request a package to be deleted:
48+
49+ >>> cprov = webservice.get("/~cprov").jsonBody()
50+ >>> pubs = webservice.named_get(
51+ ... cprov_archive['self_link'], 'getPublishedSources',
52+ ... source_name="testwebservice", version="666",
53+ ... exact_match=True).jsonBody()
54+ >>> print pubs['total_size']
55+ 1
56+ >>> package = pubs['entries'][0]['self_link']
57+ >>> response = webservice.named_post(
58+ ... package, 'requestDeletion', removed_by=cprov['self_link'],
59+ ... removal_comment="No longer needed")
60+ >>> print response
61+ HTTP/1.1 200 Ok
62+ ...
63+
64+After removal, the package is marked as such:
65+
66+ >>> pubs = webservice.named_get(
67+ ... cprov_archive['self_link'], 'getPublishedSources',
68+ ... source_name="testwebservice", version="666",
69+ ... exact_match=True).jsonBody()
70+ >>> print pubs['entries'][0]['removal_comment']
71+ No longer needed
72+
73 Privacy
74 =======
75

Subscribers

People subscribed via source and target branches

to status/vote changes: