Merge lp:~salgado/launchpad/expose-blueprints into lp:launchpad
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Approved by: | Guilherme Salgado on 2010-11-29 | ||||
| Approved revision: | no longer in the source branch. | ||||
| Merged at revision: | 11997 | ||||
| Proposed branch: | lp:~salgado/launchpad/expose-blueprints | ||||
| Merge into: | lp:launchpad | ||||
| Diff against target: |
1054 lines (+690/-99) 11 files modified
lib/canonical/launchpad/interfaces/_schema_circular_imports.py (+14/-0) lib/lp/app/doc/tales.txt (+6/-2) lib/lp/blueprints/interfaces/specification.py (+133/-78) lib/lp/blueprints/interfaces/specificationtarget.py (+42/-6) lib/lp/blueprints/interfaces/webservice.py (+1/-0) lib/lp/blueprints/model/specification.py (+5/-2) lib/lp/blueprints/model/sprint.py (+4/-3) lib/lp/blueprints/stories/standalone/sprint-links.txt (+0/-4) lib/lp/blueprints/tests/test_implements.py (+65/-0) lib/lp/blueprints/tests/test_webservice.py (+395/-0) lib/lp/testing/factory.py (+25/-4) |
||||
| To merge this branch: | bzr merge lp:~salgado/launchpad/expose-blueprints | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Michael Hudson-Doyle | 2010-11-25 | Approve on 2010-11-26 | |
|
Review via email:
|
|||
Commit Message
[r=mwhudson]
Description of the Change
This branch exposes ISpecification attributes on the 'devel' version of the webservice.
I left out some controversial fields (i.e. .productseries, .distroseries) and exported .target as read-only for simplicity and because this diff is already too big.
Most of the changes here come from https:/
| Guilherme Salgado (salgado) wrote : | # |
| Michael Hudson-Doyle (mwhudson) wrote : | # |
Hi Salgado,
Yay for progress on this issue. I entirely support the postponing of
all the difficult stuff :-)
I have some quibbles about the tests, but nothing serious I hope.
> === modified file 'lib/canonical/
> --- lib/canonical/
> +++ lib/canonical/
> @@ -34,6 +34,10 @@
> )
> from lp.blueprints.
> from lp.blueprints.
> +from lp.blueprints.
> + IHasSpecifications,
> + ISpecificationT
> + )
> from lp.bugs.
> IBug,
> IFrontPageBugAd
> @@ -516,3 +520,13 @@
>
> # IProductSeries
> patch_reference
> +
> +# ISpecificationT
> +patch_
> + ISpecificationT
> +
> +# IHasSpecifications
> +patch_
> + IHasSpecifications, 'all_specificat
> +patch_
> + IHasSpecifications, 'valid_
It's a shame that we don't have the app specific circular import files
yet... oh well.
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -19,7 +19,12 @@
> ]
>
>
> -from lazr.restful.
> +from lazr.restful.
> + exported,
> + export_
> + )
> +from lazr.restful.fields import ReferenceChoice
> +
> from zope.component import getUtility
> from zope.interface import (
> Attribute,
> @@ -44,9 +49,13 @@
> SpecificationLi
> SpecificationPr
> )
> -from lp.blueprints.
> +from lp.blueprints.
> + IHasSpecifications,
> + ISpecificationT
> + )
> from lp.blueprints.
> from lp.code.
> +from lp.registry.
> from lp.registry.
> from lp.registry.
> from lp.services.fields import (
> @@ -119,48 +128,69 @@
> class INewSpecificati
> """A schema for a new specification."""
>
> - name = SpecNameField(
> - title=_('Name'), required=True, readonly=False,
> - description=_(
> - "May contain lower-case letters, numbers, and dashes. "
> - "It will be used in the specification url. "
> - "Examples: mozilla-
> - title = Title(
> - title=_('Title'), required=True, description=_(
> - "Describe the feature as clearly as possible in up to 70 "
> - ...
| Guilherme Salgado (salgado) wrote : | # |
Hi Michael,
Thanks for the review!
On Fri, 2010-11-26 at 01:12 +0000, Michael Hudson-Doyle wrote:
> Review: Approve
> Hi Salgado,
>
> Yay for progress on this issue. I entirely support the postponing of
> all the difficult stuff :-)
>
> I have some quibbles about the tests, but nothing serious I hope.
I like all your suggestions and since it's Friday and I'm all excited
with the weekend approaching, I'm proposing even more changes. :)
>
> > === modified file 'lib/canonical/
> > --- lib/canonical/
> > +++ lib/canonical/
> > @@ -34,6 +34,10 @@
> > )
> > from lp.blueprints.
> > from lp.blueprints.
> > +from lp.blueprints.
> > + IHasSpecifications,
> > + ISpecificationT
> > + )
> > from lp.bugs.
> > IBug,
> > IFrontPageBugAd
> > @@ -516,3 +520,13 @@
> >
> > # IProductSeries
> > patch_reference
> > +
> > +# ISpecificationT
> > +patch_
> > + ISpecificationT
> > +
> > +# IHasSpecifications
> > +patch_
> > + IHasSpecifications, 'all_specificat
> > +patch_
> > + IHasSpecifications, 'valid_
>
> It's a shame that we don't have the app specific circular import files
> yet... oh well.
That'd be a slight improvement, but it's still a PITA to maintain these
"patches".
> > === added file 'lib/lp/
> > --- lib/lp/
> > +++ lib/lp/
> > @@ -0,0 +1,410 @@
> > +# Copyright 2009 Canonical Ltd. This software is licensed under the
> > +# GNU Affero General Public License version 3 (see the file LICENSE).
> > +
> > +"""Webservice unit tests related to Launchpad blueprints."""
> > +
> > +__metaclass__ = type
> > +
> > +from canonical.testing import DatabaseFunctio
> > +from canonical.
> > +from lp.blueprints.
> > + SpecificationDe
> > + SpecificationPr
> > +from lp.testing import (
> > + launchpadlib_for, TestCaseWithFac
> > +
> > +
> > +class SpecificationWe
> > +
> > + def makeProduct(self):
> > + return self.factory.
> > +
> > + def makeDistributio
> > + return self.factory.
>
> I don't particularly like these helpers. Why can't the tests that
> care about the names specify the names?
Yeah, good catch; I got rid of them.
>
> > + def getLaunchpadlib
> > + user = self.factory.
> > + return launchpadlib_
| Guilherme Salgado (salgado) wrote : | # |
I had to do a few other changes because Sprint currently doesn't
implement all of IHasSpecifications as it claims to do.
This became apparent because some code which gets a snapshot of a Sprint
tried to access .all_specifications as part of that. This probably
happened only now because the snapshotting code ignores Attribute fields
so it was ignoring that and other fields of IHasSpecifications.
These changes are in r11984
| Guilherme Salgado (salgado) wrote : | # |
And I'd also like to sneak this extra tiny change (r11985) to expose implementation_
| Michael Hudson-Doyle (mwhudson) wrote : | # |
On Fri, 26 Nov 2010 13:11:21 -0000, Guilherme Salgado <email address hidden> wrote:
> Hi Michael,
>
> Thanks for the review!
>
> On Fri, 2010-11-26 at 01:12 +0000, Michael Hudson-Doyle wrote:
> > Review: Approve
> > Hi Salgado,
> >
> > Yay for progress on this issue. I entirely support the postponing of
> > all the difficult stuff :-)
> >
> > I have some quibbles about the tests, but nothing serious I hope.
>
> I like all your suggestions and since it's Friday and I'm all excited
> with the weekend approaching, I'm proposing even more changes. :)
Hah!
> > > === modified file 'lib/canonical/
> > > --- lib/canonical/
> > > +++ lib/canonical/
> > > @@ -34,6 +34,10 @@
> > > )
> > > from lp.blueprints.
> > > from lp.blueprints.
> > > +from lp.blueprints.
> > > + IHasSpecifications,
> > > + ISpecificationT
> > > + )
> > > from lp.bugs.
> > > IBug,
> > > IFrontPageBugAd
> > > @@ -516,3 +520,13 @@
> > >
> > > # IProductSeries
> > > patch_reference
> > > +
> > > +# ISpecificationT
> > > +patch_
> > > + ISpecificationT
> > > +
> > > +# IHasSpecifications
> > > +patch_
> > > + IHasSpecifications, 'all_specificat
> > > +patch_
> > > + IHasSpecifications, 'valid_
> >
> > It's a shame that we don't have the app specific circular import files
> > yet... oh well.
>
> That'd be a slight improvement, but it's still a PITA to maintain these
> "patches".
Yeah. I saw what you had to do with SprintSpecification too :/
> > > === added file 'lib/lp/
> > > --- lib/lp/
> > > +++ lib/lp/
> > > @@ -0,0 +1,410 @@
> > > +# Copyright 2009 Canonical Ltd. This software is licensed under the
> > > +# GNU Affero General Public License version 3 (see the file LICENSE).
> > > +
> > > +"""Webservice unit tests related to Launchpad blueprints."""
> > > +
> > > +__metaclass__ = type
> > > +
> > > +from canonical.testing import DatabaseFunctio
> > > +from canonical.
> > > +from lp.blueprints.
> > > + SpecificationDe
> > > + SpecificationPr
> > > +from lp.testing import (
> > > + launchpadlib_for, TestCaseWithFac
> > > +
> > > +
> > > +class SpecificationWe
> > > +
> > > + def makeProduct(self):
> > > + return self.factory.
> > > +
> > > + def makeDistributio
> > > + return self.factory.

My last commit removes another controversial bit by exposing ISpecification. definition_ status as read only. That attribute will probably need a mutator (which in turn requires some refactoring) before it can be exported.