~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/code/publisher.py

  • Committer: Curtis Hovey
  • Date: 2011-08-12 14:39:51 UTC
  • mto: This revision was merged to the branch mainline in revision 13685.
  • Revision ID: curtis.hovey@canonical.com-20110812143951-74vfvrt37gtt4fz2
Sorted imports.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2010-2011 Canonical Ltd.  This software is licensed under the
 
1
# Copyright 2010 Canonical Ltd.  This software is licensed under the
2
2
# GNU Affero General Public License version 3 (see the file LICENSE).
3
3
 
4
4
"""Code's custom publication."""
8
8
    'CodeBrowserRequest',
9
9
    'CodeLayer',
10
10
    'code_request_publication_factory',
11
 
    'LaunchpadBranchContainer',
12
11
    ]
13
12
 
14
13
 
18
17
    IDefaultBrowserLayer,
19
18
    )
20
19
 
21
 
from lp.services.webapp.interfaces import ILaunchpadContainer
22
 
from lp.services.webapp.publication import LaunchpadBrowserPublication
23
 
from lp.services.webapp.publisher import LaunchpadContainer
24
 
from lp.services.webapp.servers import (
 
20
from canonical.launchpad.webapp.publication import LaunchpadBrowserPublication
 
21
from canonical.launchpad.webapp.servers import (
25
22
    LaunchpadBrowserRequest,
26
23
    VHostWebServiceRequestPublicationFactory,
27
24
    )
39
36
def code_request_publication_factory():
40
37
    return VHostWebServiceRequestPublicationFactory(
41
38
        'code', CodeBrowserRequest, LaunchpadBrowserPublication)
42
 
 
43
 
 
44
 
class LaunchpadBranchContainer(LaunchpadContainer):
45
 
 
46
 
    def isWithin(self, scope):
47
 
        """Is this branch within the given scope?
48
 
 
49
 
        If a branch has a product, it is always in the scope that product or
50
 
        its project.  Otherwise it's not in any scope.
51
 
        """
52
 
        if self.context.product is None:
53
 
            return False
54
 
        return ILaunchpadContainer(self.context.product).isWithin(scope)