Merge lp:~jml/launchpad/expose-blueprints into lp:launchpad

Proposed by Jonathan Lange
Status: Rejected
Rejected by: Jonathan Lange
Proposed branch: lp:~jml/launchpad/expose-blueprints
Merge into: lp:launchpad
Diff against target: 70 lines (+35/-6)
2 files modified
lib/canonical/launchpad/pagetests/webservice/xx-specification.txt (+24/-0)
lib/lp/blueprints/interfaces/specification.py (+11/-6)
To merge this branch: bzr merge lp:~jml/launchpad/expose-blueprints
Reviewer Review Type Date Requested Status
Jonathan Lange (community) Approve
Review via email: mp+15060@code.launchpad.net

Commit message

Expose 'drafter' on specifications, and improve the documentation a little.

To post a comment you must log in.
Revision history for this message
Jonathan Lange (jml) wrote :

Expose 'drafter' on specifications, and improve the documentation a little.

Revision history for this message
Matt Zimmerman (mdz) wrote :

This code is awesome. Thank you!

--
 - mdz

Revision history for this message
Jonathan Lange (jml) wrote :

Wow, you are good. Land it right away.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'lib/canonical/launchpad/pagetests/webservice/xx-specification.txt'
2--- lib/canonical/launchpad/pagetests/webservice/xx-specification.txt 1970-01-01 00:00:00 +0000
3+++ lib/canonical/launchpad/pagetests/webservice/xx-specification.txt 2009-11-19 21:50:35 +0000
4@@ -0,0 +1,24 @@
5+
6+= Prelude =
7+
8+ >>> login(ANONYMOUS)
9+ >>> specification = factory.makeSpecification()
10+ >>> spec_url = canonical_url(specification, rootsite='api')
11+ >>> drafter = factory.makePerson()
12+ >>> drafter_url = canonical_url(drafter, rootsite='api')
13+ >>> logout()
14+
15+= Specifications =
16+
17+Specifications are exposed over the API.
18+
19+ >>> from simplejson import dumps
20+ >>> web_spec = webservice.get(spec_url).jsonBody()
21+ >>> web_spec['drafter_link'] is None
22+ True
23+ >>> patch = dict(drafter_link=drafter_url)
24+ >>> webservice.patch(
25+ ... spec_url, 'application/json', dumps(patch))
26+ >>> web_spec = webservice.get(spec_url).jsonBody()
27+ >>> web_spec['drafter_link'] == drafter_url
28+ True
29
30=== modified file 'lib/lp/blueprints/interfaces/specification.py'
31--- lib/lp/blueprints/interfaces/specification.py 2009-07-17 00:26:05 +0000
32+++ lib/lp/blueprints/interfaces/specification.py 2009-11-19 21:50:35 +0000
33@@ -28,7 +28,8 @@
34
35 from lazr.restful.declarations import (
36 REQUEST_USER, call_with, export_as_webservice_entry,
37- export_write_operation, operation_parameters, operation_returns_entry)
38+ exported, export_write_operation, operation_parameters,
39+ operation_returns_entry)
40 from lazr.restful.fields import Reference
41 from zope.interface import Interface, Attribute
42 from zope.component import getUtility
43@@ -586,11 +587,12 @@
44 title=_('Assignee'), required=False,
45 description=_("The person responsible for implementing the feature."),
46 vocabulary='ValidPersonOrTeam')
47- drafter = PublicPersonChoice(
48- title=_('Drafter'), required=False,
49- description=_(
50+ drafter = exported(
51+ PublicPersonChoice(
52+ title=_('Drafter'), required=False,
53+ description=_(
54 "The person responsible for drafting the specification."),
55- vocabulary='ValidPersonOrTeam')
56+ vocabulary='ValidPersonOrTeam'))
57 approver = PublicPersonChoice(
58 title=_('Approver'), required=False,
59 description=_(
60@@ -645,7 +647,10 @@
61
62 class ISpecification(INewSpecification, INewSpecificationTarget, IHasOwner,
63 ICanBeMentored, IHasLinkedBranches):
64- """A Specification."""
65+ """A Specification.
66+
67+ Also known as a blueprint.
68+ """
69
70 export_as_webservice_entry()
71