1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""ILaunchpadContainer adapters."""
__metaclass__ = type
__all__ = [
'LaunchpadProductContainer',
'LaunchpadDistributionSourcePackageContainer',
]
from lp.services.webapp.publisher import LaunchpadContainer
class LaunchpadProductContainer(LaunchpadContainer):
def isWithin(self, scope):
"""Is this product within the given scope?
A product is within itself or its project.
"""
return scope == self.context or scope == self.context.project
class LaunchpadDistributionSourcePackageContainer(LaunchpadContainer):
def isWithin(self, scope):
"""Is this distribution source package within the given scope?
A distribution source package is within its distribution.
"""
return scope == self.context or scope == self.context.distribution
|