353
353
request_factory = ProtocolErrorRequest
354
354
publication_factory = ProtocolErrorPublicationFactory(
355
405, headers={'Allow':" ".join(self.methods)})
355
405, headers={'Allow': " ".join(self.methods)})
356
356
factories = (request_factory, publication_factory)
1015
1015
class MainLaunchpadPublication(LaunchpadBrowserPublication):
1016
1016
"""The publication used for the main Launchpad site."""
1020
class BlueprintBrowserRequest(LaunchpadBrowserRequest):
1021
implements(canonical.launchpad.layers.BlueprintLayer)
1023
class BlueprintPublication(LaunchpadBrowserPublication):
1024
"""The publication used for the Blueprint site."""
1028
class CodePublication(LaunchpadBrowserPublication):
1029
"""The publication used for the Code site."""
1031
class CodeBrowserRequest(LaunchpadBrowserRequest):
1032
implements(canonical.launchpad.layers.CodeLayer)
1036
class TranslationsPublication(LaunchpadBrowserPublication):
1037
"""The publication used for the Translations site."""
1039
class TranslationsBrowserRequest(LaunchpadBrowserRequest):
1040
implements(canonical.launchpad.layers.TranslationsLayer)
1042
def __init__(self, body_instream, environ, response=None):
1043
super(TranslationsBrowserRequest, self).__init__(
1044
body_instream, environ, response)
1045
# Some of the responses from translations vary based on language.
1046
self.response.setHeader(
1047
'Vary', 'Cookie, Authorization, Accept-Language')
1051
class BugsPublication(LaunchpadBrowserPublication):
1052
"""The publication used for the Bugs site."""
1054
class BugsBrowserRequest(LaunchpadBrowserRequest):
1055
implements(canonical.launchpad.layers.BugsLayer)
1059
class AnswersPublication(LaunchpadBrowserPublication):
1060
"""The publication used for the Answers site."""
1062
class AnswersBrowserRequest(LaunchpadBrowserRequest):
1063
implements(canonical.launchpad.layers.AnswersLayer)
1065
def __init__(self, body_instream, environ, response=None):
1066
super(AnswersBrowserRequest, self).__init__(
1067
body_instream, environ, response)
1068
# Many of the responses from Answers vary based on language.
1069
self.response.setHeader(
1070
'Vary', 'Cookie, Authorization, Accept-Language')
1073
1019
class AccountPrincipalMixin:
1074
1020
"""Mixin for publication that works with person-less accounts."""
1345
1291
class PublicXMLRPCPublication(LaunchpadBrowserPublication):
1346
1292
"""The publication used for public XML-RPC requests."""
1347
1294
def handleException(self, object, request, exc_info, retry_allowed=True):
1348
1295
LaunchpadBrowserPublication.handleException(
1349
self, object, request, exc_info, retry_allowed
1296
self, object, request, exc_info, retry_allowed)
1351
1297
OpStats.stats['xml-rpc faults'] += 1
1353
1299
def endRequest(self, request, object):
1494
1440
VWSHRP('mainsite', LaunchpadBrowserRequest, MainLaunchpadPublication,
1495
1441
handle_default_host=True),
1496
VWSHRP('blueprints', BlueprintBrowserRequest, BlueprintPublication),
1497
VWSHRP('code', CodeBrowserRequest, CodePublication),
1498
VWSHRP('translations', TranslationsBrowserRequest,
1499
TranslationsPublication),
1500
VWSHRP('bugs', BugsBrowserRequest, BugsPublication),
1501
VWSHRP('answers', AnswersBrowserRequest, AnswersPublication),
1502
1442
VHRP('feeds', FeedsBrowserRequest, FeedsPublication),
1503
1443
WebServiceRequestPublicationFactory(
1504
1444
'api', WebServiceClientRequest, WebServicePublication),
1505
1445
XMLRPCRequestPublicationFactory(
1506
'xmlrpc', PublicXMLRPCRequest, PublicXMLRPCPublication)
1446
'xmlrpc', PublicXMLRPCRequest, PublicXMLRPCPublication),
1509
1449
if config.launchpad.enable_test_openid_provider: