[Launchpad-reviewers] [Merge] lp:~cjwatson/launchpad/git-repository-container into lp:launchpad

2016-02-28 Thread Colin Watson
Colin Watson has proposed merging 
lp:~cjwatson/launchpad/git-repository-container into lp:launchpad with 
lp:~cjwatson/launchpad/refactor-launchpad-container as a prerequisite.

Commit message:
Add ILaunchpadContainer implementation for Git repositories.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/git-repository-container/+merge/287413

Add ILaunchpadContainer implementation for Git repositories.  It's an easy 
extension, and we're going to want this for caveats.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
lp:~cjwatson/launchpad/git-repository-container into lp:launchpad.
=== modified file 'lib/lp/code/configure.zcml'
--- lib/lp/code/configure.zcml	2016-01-11 19:16:04 +
+++ lib/lp/code/configure.zcml	2016-02-28 19:36:09 +
@@ -816,6 +816,10 @@
 interface="lp.code.interfaces.gitrepository.IGitRepositoryEdit"
 set_schema="lp.code.interfaces.gitrepository.IGitRepositoryEditableAttributes" />
   
+  
   

=== modified file 'lib/lp/code/publisher.py'
--- lib/lp/code/publisher.py	2016-02-28 19:36:09 +
+++ lib/lp/code/publisher.py	2016-02-28 19:36:09 +
@@ -64,3 +64,13 @@
 self.context.target.context, ILaunchpadContainer)
 if adapter is not None:
 yield adapter
+
+
+class LaunchpadGitRepositoryContainer(LaunchpadContainer):
+
+def getParentContainers(self):
+"""See `ILaunchpadContainer`."""
+# A repository is within its target.
+adapter = queryAdapter(self.context.target, ILaunchpadContainer)
+if adapter is not None:
+yield adapter

=== modified file 'lib/lp/registry/doc/launchpad-container.txt'
--- lib/lp/registry/doc/launchpad-container.txt	2016-02-28 19:36:09 +
+++ lib/lp/registry/doc/launchpad-container.txt	2016-02-28 19:36:09 +
@@ -120,3 +120,20 @@
 None
 >>> ILaunchpadContainer(junk).isWithin('/firefox')
 False
+
+
+== Git repositories ==
+
+A Git repository is within its target.
+
+>>> sample_person = getUtility(IPersonSet).getByName('name12')
+>>> firefox_git = factory.makeGitRepository(target=firefox)
+>>> ILaunchpadContainer(firefox_git).isWithin('/firefox')
+True
+>>> ILaunchpadContainer(firefox_git).isWithin('/mozilla')
+True
+
+But it's not within anything other than its target.
+
+>>> ILaunchpadContainer(firefox_git).isWithin('/ubuntu/+source/evolution')
+False

___
Mailing list: https://launchpad.net/~launchpad-reviewers
Post to : launchpad-reviewers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~launchpad-reviewers
More help   : https://help.launchpad.net/ListHelp


[Launchpad-reviewers] [Merge] lp:~cjwatson/launchpad/refactor-launchpad-container into lp:launchpad

2016-02-28 Thread Colin Watson
Colin Watson has proposed merging 
lp:~cjwatson/launchpad/refactor-launchpad-container into lp:launchpad.

Commit message:
Refactor LaunchpadContainer to work with scope URLs and to automatically follow 
the canonical URL chain.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/refactor-launchpad-container/+merge/287412

Refactor LaunchpadContainer to work with scope URLs and to automatically follow 
the canonical URL chain.  This is in preparation for introducing caveats, where 
we'll definitely want to work with URL paths rather than objects.

LaunchpadPrincipal.scope_url will change again, but this is a relatively 
non-painful way to allow the LaunchpadContainer changes to land in isolation.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
lp:~cjwatson/launchpad/refactor-launchpad-container into lp:launchpad.
=== modified file 'lib/lp/bugs/publisher.py'
--- lib/lp/bugs/publisher.py	2015-07-08 16:05:11 +
+++ lib/lp/bugs/publisher.py	2016-02-28 19:25:32 +
@@ -1,4 +1,4 @@
-# Copyright 2010-2011 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Bugs' custom publication."""
@@ -55,12 +55,8 @@
 
 class LaunchpadBugContainer(LaunchpadContainer):
 
-def isWithin(self, scope):
-"""Is this bug within the given scope?
-
-A bug is in the scope of any of its bugtasks' targets.
-"""
+def getParentContainers(self):
+"""See `ILaunchpadContainer`."""
+# A bug is within any of its bugtasks' targets.
 for bugtask in self.context.bugtasks:
-if ILaunchpadContainer(bugtask.target).isWithin(scope):
-return True
-return False
+yield ILaunchpadContainer(bugtask.target)

=== modified file 'lib/lp/code/publisher.py'
--- lib/lp/code/publisher.py	2015-07-08 16:05:11 +
+++ lib/lp/code/publisher.py	2016-02-28 19:25:32 +
@@ -1,4 +1,4 @@
-# Copyright 2010-2011 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Code's custom publication."""
@@ -13,6 +13,7 @@
 ]
 
 
+from zope.component import queryAdapter
 from zope.interface import implementer
 from zope.publisher.interfaces.browser import (
 IBrowserRequest,
@@ -56,12 +57,10 @@
 
 class LaunchpadBranchContainer(LaunchpadContainer):
 
-def isWithin(self, scope):
-"""Is this branch within the given scope?
-
-If a branch has a product, it is always in the scope that product or
-its project.  Otherwise it's not in any scope.
-"""
-if self.context.product is None:
-return False
-return ILaunchpadContainer(self.context.product).isWithin(scope)
+def getParentContainers(self):
+"""See `ILaunchpadContainer`."""
+# A branch is within its target.
+adapter = queryAdapter(
+self.context.target.context, ILaunchpadContainer)
+if adapter is not None:
+yield adapter

=== modified file 'lib/lp/registry/configure.zcml'
--- lib/lp/registry/configure.zcml	2016-02-05 20:28:29 +
+++ lib/lp/registry/configure.zcml	2016-02-28 19:25:32 +
@@ -613,7 +613,7 @@
 
+factory="lp.services.webapp.publisher.LaunchpadContainer"/>
 >> ubuntu = getUtility(IDistributionSet)['ubuntu']
 >>> evolution = ubuntu.getSourcePackage('evolution')
 
-The ILaunchpadContainer defines only the isWithin(context) method, which
-returns True if this context is the given one or is within it.
+The ILaunchpadContainer defines only the isWithin(scope_url) method, which
+returns True if this context is at the given URL or is within it.
 
 A product is within itself or its project group.
 
->>> ILaunchpadContainer(firefox).isWithin(firefox)
-True
->>> ILaunchpadContainer(firefox).isWithin(mozilla)
-True
->>> ILaunchpadContainer(firefox).isWithin(ubuntu)
+>>> ILaunchpadContainer(firefox).isWithin('/firefox')
+True
+>>> ILaunchpadContainer(firefox).isWithin('/mozilla')
+True
+>>> ILaunchpadContainer(firefox).isWithin('/ubuntu')
 False
 >>> verifyObject(ILaunchpadContainer, ILaunchpadContainer(firefox))
 True
 
 A project group is only within itself.
 
->>> ILaunchpadContainer(mozilla).isWithin(mozilla)
+>>> ILaunchpadContainer(mozilla).isWithin('/mozilla')
 True
->>> ILaunchpadContainer(mozilla).isWithin(firefox)
+>>> ILaunchpadContainer(mozilla).isWithin('/firefox')
 False
->>> ILaunchpadContainer(mozilla).isWithin(ubuntu)
+>>> ILaunchpadContainer(mozilla).isWithin('/ubuntu')
 False
 >>> verifyObject(ILaunchpadContainer, ILaunchpadContainer(mozilla))
 

Re: [Launchpad-reviewers] [Merge] lp:~cjwatson/launchpad/snap-delete-with-builds into lp:launchpad

2016-02-28 Thread William Grant
Review: Approve code


-- 
https://code.launchpad.net/~cjwatson/launchpad/snap-delete-with-builds/+merge/287408
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.

___
Mailing list: https://launchpad.net/~launchpad-reviewers
Post to : launchpad-reviewers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~launchpad-reviewers
More help   : https://help.launchpad.net/ListHelp