~launchpad-pqm/launchpad/devel

8687.15.18 by Karl Fogel
Add the copyright header block to files under lib/canonical/.
1
# Copyright 2009 Canonical Ltd.  This software is licensed under the
2
# GNU Affero General Public License version 3 (see the file LICENSE).
4483.4.22 by Barry Warsaw
Back out of the abortive attempt at exposing a private xmlrpc port for the
3
4
"""Define the layers used in Launchpad.
5
6
Also define utilities that manipulate layers.
1102 by Canonical.com Patch Queue Manager
Lucille had some XXXs which should have been NOTEs
7
"""
8
9
__metaclass__ = type
63.1.156 by Robert Collins
Add new InternalHTTPLayer for internal to datacentre requests.
10
11403.1.4 by Henning Eggers
Reformatted imports using format-imports script r32.
11
from lazr.restful.interfaces import IWebServiceLayer
9678.22.4 by Gary Poster
for test convenience, make PageTestLayer provide IBrowserSkinType with a code declaration.
12
from zope.interface import (
11403.1.4 by Henning Eggers
Reformatted imports using format-imports script r32.
13
    alsoProvides,
14
    directlyProvidedBy,
15
    directlyProvides,
16
    Interface,
17
    )
6061.7.2 by Curtis Hovey
This is the minimal set of changes to get make run to complete.
18
from zope.publisher.interfaces.browser import (
11403.1.4 by Henning Eggers
Reformatted imports using format-imports script r32.
19
    IBrowserRequest,
20
    IBrowserSkinType,
21
    IDefaultBrowserLayer,
22
    )
6096.9.1 by Francis J. Lacoste
Clean-up resource operation interface and define a base WebServiceLayer in LAZR.
23
4605.1.1 by Barry Warsaw
Add an `xmlrpc-private` hostname to the launchpad.dev domain, and
24
1102 by Canonical.com Patch Queue Manager
Lucille had some XXXs which should have been NOTEs
25
def setAdditionalLayer(request, layer):
26
    directlyProvides(request, directlyProvidedBy(request) + layer)
27
4605.1.1 by Barry Warsaw
Add an `xmlrpc-private` hostname to the launchpad.dev domain, and
28
1102 by Canonical.com Patch Queue Manager
Lucille had some XXXs which should have been NOTEs
29
def setFirstLayer(request, layer):
30
    directlyProvides(request, layer, directlyProvidedBy(request))
31
2455 by Canonical.com Patch Queue Manager
r=bjornt greatly improved error pages in pagetests and debug port. introduced new url for a debug root page. fixed bug when redirecting for logging out.
32
6061.11.1 by Curtis Hovey
Revised the MenuAPI to accept a view instead of the CONTEXTS dict because
33
class LaunchpadLayer(IBrowserRequest, IDefaultBrowserLayer):
1102 by Canonical.com Patch Queue Manager
Lucille had some XXXs which should have been NOTEs
34
    """The `LaunchpadLayer` layer."""
35
4003.1.1 by Carlos Perello Marin
Fixed Translation virtual hosting
36
2455 by Canonical.com Patch Queue Manager
r=bjornt greatly improved error pages in pagetests and debug port. introduced new url for a debug root page. fixed bug when redirecting for logging out.
37
class DebugLayer(Interface):
38
    """The `DebugLayer` layer.
39
40
    This derives from Interface beacuse it is just a marker that this
41
    is a debug-related request.
42
    """
43
4003.1.1 by Carlos Perello Marin
Fixed Translation virtual hosting
44
11073.1.6 by Guilherme Salgado
Fix the IAbsoluteURL issue
45
class APIDocLayer(IBrowserRequest, IDefaultBrowserLayer):
46
    """The `APIDocLayer` layer."""
47
48
10065.2.3 by Guilherme Salgado
Move the test openid views under a newly created testopenid vhost.
49
class TestOpenIDLayer(LaunchpadLayer):
50
    """The `TestOpenIDLayer` layer."""
51
52
5038.2.1 by Matthew Paul Thomas
Makes the PageTestLayer actually work. Code by the amazing James Henstridge.
53
class PageTestLayer(LaunchpadLayer):
2455 by Canonical.com Patch Queue Manager
r=bjornt greatly improved error pages in pagetests and debug port. introduced new url for a debug root page. fixed bug when redirecting for logging out.
54
    """The `PageTestLayer` layer. (need to register a 404 view for this and
55
    for the debug page too.  and make the debugview a base class in the
56
    debug view and make system error, not found and unauthorized and
57
    forbidden views.
58
59
    This layer is applied to the request that is used for running page tests.
5038.2.2 by Matthew Paul Thomas
Registers all bounty-related pages in the PageTestLayer, so that they're no longer accessible by humans.
60
    Pages registered with this layer are accessible to pagetests but return
61
    404s when visited interactively, so this should be used only for pages we
62
    want to maintain but not expose to users.
63
64
    The SystemErrorView base class looks at the request to see if it provides
65
    this interface.  If so, it renders tracebacks as plain text.
2455 by Canonical.com Patch Queue Manager
r=bjornt greatly improved error pages in pagetests and debug port. introduced new url for a debug root page. fixed bug when redirecting for logging out.
66
    """
9678.22.4 by Gary Poster
for test convenience, make PageTestLayer provide IBrowserSkinType with a code declaration.
67
# A few tests register this interface directly as a layer, bypassing the zcml
68
# machinery.  This means that they don't get the proper SkinType interface
69
# applied to them.  We add it here for convenience.
70
alsoProvides(PageTestLayer, IBrowserSkinType)
2416 by Canonical.com Patch Queue Manager
standalone ShipItNG and a lot more new features. r=kiko,stub
71
3152.1.5 by Guilherme Salgado
Turn shipit into three: one for KUbuntu, one for EdUbuntu and one for Ubuntu.
72
4982.2.1 by Brad Crittenden
Working ZCML feeds directive
73
class FeedsLayer(LaunchpadLayer):
4898.6.6 by Edwin Grubbs
Merged in Elliot's branch which had changes from trunk.
74
    """The `FeedsLayer` Layer."""
4934.3.2 by Elliot Murphy
checkpoint after adding FeedsLayer
75
5835.6.3 by Francis J. Lacoste
Define a WebServiceLayer.
76
7893.4.8 by Francis J. Lacoste
Rename WebServiceLayer to IWebServiceClientRequest.
77
class WebServiceLayer(IWebServiceLayer, LaunchpadLayer):
5835.6.3 by Francis J. Lacoste
Define a WebServiceLayer.
78
    """The layer for web service requests."""