Merge lp://staging/~cody-somerville/launchpad/bug-444266 into lp://staging/launchpad

Proposed by Cody A.W. Somerville
Status: Merged
Approved by: Gavin Panella
Approved revision: no longer in the source branch.
Merged at revision: 10835
Proposed branch: lp://staging/~cody-somerville/launchpad/bug-444266
Merge into: lp://staging/launchpad
Diff against target: 313 lines (+141/-19)
8 files modified
lib/canonical/launchpad/interfaces/launchpad.py (+3/-2)
lib/lp/bugs/browser/bugsupervisor.py (+20/-3)
lib/lp/bugs/interfaces/bugsupervisor.py (+20/-9)
lib/lp/bugs/stories/webservice/xx-bug-target.txt (+83/-0)
lib/lp/registry/interfaces/distribution.py (+4/-2)
lib/lp/registry/interfaces/product.py (+5/-3)
lib/lp/registry/stories/webservice/xx-distribution.txt (+2/-0)
lib/lp/registry/stories/webservice/xx-project-registry.txt (+4/-0)
To merge this branch: bzr merge lp://staging/~cody-somerville/launchpad/bug-444266
Reviewer Review Type Date Requested Status
Gavin Panella (community) Approve
Review via email: mp+24273@code.staging.launchpad.net

Commit message

Expose bug supervisor and security contact via webservices API for projects and distributions.

Description of the change

Export bug_supervisor and security_contact to implement LP #444266

To post a comment you must log in.
Revision history for this message
Gavin Panella (allenap) wrote :
Download full text (11.0 KiB)

Hi Cody,

Thanks for doing this! This is a nice branch. I have a few small
comments, that's all. Approved, but please address those issues before
landing it.

Gavin.

> === modified file 'lib/canonical/launchpad/interfaces/launchpad.py'
> --- lib/canonical/launchpad/interfaces/launchpad.py 2010-04-19 14:47:49 +0000
> +++ lib/canonical/launchpad/interfaces/launchpad.py 2010-04-28 16:42:08 +0000
> @@ -14,6 +14,7 @@
> from zope.schema import Bool, Choice, Int, TextLine
> from persistent import IPersistent
>
> +from lazr.restful.declarations import exported
> from lazr.restful.interfaces import IServiceRootResource
> from canonical.launchpad import _
> from canonical.launchpad.fields import PublicPersonChoice
> @@ -439,11 +440,11 @@
> class IHasSecurityContact(Interface):
> """An object that has a security contact."""
>
> - security_contact = PublicPersonChoice(
> + security_contact = exported(PublicPersonChoice(
> title=_("Security Contact"),
> description=_(
> "The person or team who handles security-related bug reports"),
> - required=False, vocabulary='ValidPersonOrTeam')
> + required=False, vocabulary='ValidPersonOrTeam'))
>
>
> class IHasIcon(Interface):
>
> === modified file 'lib/lp/bugs/browser/bugsupervisor.py'
> --- lib/lp/bugs/browser/bugsupervisor.py 2009-11-12 15:33:27 +0000
> +++ lib/lp/bugs/browser/bugsupervisor.py 2010-04-28 16:42:08 +0000
> @@ -7,17 +7,30 @@
>
> __all__ = ['BugSupervisorEditView']
>
> -
> -from lp.bugs.interfaces.bugsupervisor import IHasBugSupervisor
> from canonical.launchpad.webapp import (
> action, canonical_url, LaunchpadEditFormView)
> from canonical.launchpad.webapp.menu import structured
> -
> +from lazr.restful.interface import copy_field, use_template
> +from zope.interface import Interface
> +
> +from lp.bugs.interfaces.bugsupervisor import IHasBugSupervisor
> +

2 blank lines between classes.

> +class BugSupervisorEditSchema(Interface):
> + """Defines the fields for the edit form.
> +
> + This is necessary to make an editable field for bug supervisor as it is
> + defined as read-only in the interface to prevent setting it directly.
> + """
> + use_template(IHasBugSupervisor, include=[
> + 'bug_supervisor',
> + ])

I don't think you need this use_template() call; its effects are
immediately overwritten below.

> + bug_supervisor = copy_field(
> + IHasBugSupervisor['bug_supervisor'], readonly=False)
>

Again, 2 blank lines.

> class BugSupervisorEditView(LaunchpadEditFormView):
> """Browser view class for editing the bug supervisor."""
>
> - schema = IHasBugSupervisor
> + schema = BugSupervisorEditSchema
> field_names = ['bug_supervisor']
>
> @property
> @@ -30,6 +43,11 @@
> """The page title."""
> return self.label
>
> + @property
> + def adapters(self):
> + """See `LaunchpadFormView`"""
> + return {BugSupervisorEditSchema: self.context}

Interesting, I've never seen this before.

> +
> @action('Change', name='change')
> def change_action(self, action, data):
> """Redirect to the target page with a success message...

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.