← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wallyworld/launchpad/projectgroup-milestone-951365 into lp:launchpad

 

Ian Booth has proposed merging lp:~wallyworld/launchpad/projectgroup-milestone-951365 into lp:launchpad.

Requested reviews:
  Curtis Hovey (sinzui)
Related bugs:
  Bug #951365 in Launchpad itself: "Accessing milestone on project group via webservice api returns has_bugs object"
  https://bugs.launchpad.net/launchpad/+bug/951365

For more details, see:
https://code.launchpad.net/~wallyworld/launchpad/projectgroup-milestone-951365/+merge/124085

== Implementation ==

For the IProjectGroup interface, I copied the milestones and all_milestones fields from IHasMilestone and overrode the collection value types to be IProjectGroupMilestone. This works but I had to change the export_as_webservice_entry() declaration for IProjectGroupMilestone to be as_of="beta" or else the WADL compilation step complained:

class IProjectGroupMilestone(IAbstractMilestone):
    """A marker interface for milestones related to a project"""
    export_as_webservice_entry(as_of="beta")

The generated WADL still has project group milestone exported for 1.0 as before so I think this is ok?

== Tests ==

I didn't add any new tests, but I did run the existing projectgroup milestone tests that I could find:

milestone-views.txt
milestone.txt
test_project_milestone.py

I also looked at https://api.launchpad.dev/devel/gnome/+milestone/2.1.6 on a local instance and confirmed that resource_type_link is now correct:

...
resource_type_link
 https://api.launchpad.dev/devel/#project_group_milestone
 self_link
 https://api.launchpad.dev/devel/gnome/+milestone/2.1.6
...


== Lint ==

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/registry/interfaces/milestone.py
  lib/lp/registry/interfaces/projectgroup.py
  lib/lp/registry/interfaces/webservice.py

-- 
https://code.launchpad.net/~wallyworld/launchpad/projectgroup-milestone-951365/+merge/124085
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
=== modified file 'lib/lp/registry/interfaces/milestone.py'
--- lib/lp/registry/interfaces/milestone.py	2012-01-10 14:24:19 +0000
+++ lib/lp/registry/interfaces/milestone.py	2012-09-13 01:13:21 +0000
@@ -307,7 +307,7 @@
 
 class IProjectGroupMilestone(IAbstractMilestone):
     """A marker interface for milestones related to a project"""
-    export_as_webservice_entry()
+    export_as_webservice_entry(as_of="beta")
 
 
 class IHasMilestones(Interface):

=== modified file 'lib/lp/registry/interfaces/projectgroup.py'
--- lib/lp/registry/interfaces/projectgroup.py	2012-09-12 11:55:21 +0000
+++ lib/lp/registry/interfaces/projectgroup.py	2012-09-13 01:13:21 +0000
@@ -28,6 +28,7 @@
     Reference,
     ReferenceChoice,
     )
+from lazr.restful.interface import copy_field
 from zope.interface import (
     Attribute,
     Interface,
@@ -72,6 +73,7 @@
 from lp.registry.interfaces.milestone import (
     ICanGetMilestonesDirectly,
     IHasMilestones,
+    IProjectGroupMilestone,
     )
 from lp.registry.interfaces.pillar import IPillar
 from lp.registry.interfaces.role import (
@@ -127,6 +129,16 @@
 
     id = Int(title=_('ID'), readonly=True)
 
+    # The following milestone collections are copied from IHasMilestone so that
+    # we can override the collection value types to be IProjectGroupMilestone.
+    milestones = copy_field(
+        IHasMilestones['milestones'],
+        value_type=Reference(schema=IProjectGroupMilestone))
+
+    all_milestones = copy_field(
+        IHasMilestones['all_milestones'],
+        value_type=Reference(schema=IProjectGroupMilestone))
+
     owner = exported(
         PublicPersonChoice(
             title=_('Maintainer'),

=== modified file 'lib/lp/registry/interfaces/webservice.py'
--- lib/lp/registry/interfaces/webservice.py	2012-03-22 23:21:24 +0000
+++ lib/lp/registry/interfaces/webservice.py	2012-09-13 01:13:21 +0000
@@ -28,6 +28,7 @@
     'IProductSeries',
     'IProductSet',
     'IProjectGroup',
+    'IProjectGroupMilestone',
     'IProjectGroupSet',
     'IServiceFactory',
     'ISharingService',
@@ -71,6 +72,7 @@
 from lp.registry.interfaces.milestone import (
     IHasMilestones,
     IMilestone,
+    IProjectGroupMilestone,
     )
 from lp.registry.interfaces.person import (
     IPerson,


Follow ups