~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/canonical/launchpad/webapp/servers.py

  • Committer: Guilherme Salgado
  • Date: 2010-07-23 08:50:49 UTC
  • mfrom: (11206 launchpad)
  • mto: This revision was merged to the branch mainline in revision 11220.
  • Revision ID: salgado@canonical.com-20100723085049-4m2tmvujxsw2ns40
mergeĀ mainline

Show diffs side-by-side

added added

removed removed

Lines of Context:
352
352
        else:
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)
357
357
 
358
358
        return factories
614
614
        """See `ISynchronizer`."""
615
615
        pass
616
616
 
 
617
 
617
618
class BrowserFormNG:
618
619
    """Wrapper that provides IBrowserFormNG around a regular form dict."""
619
620
 
680
681
    def install(cls):
681
682
        """Install the monkey patch."""
682
683
        assert not cls.installed, "Monkey patch is already installed."
 
684
 
683
685
        def _getFormInput_single(self):
684
686
            """Return the submitted form value.
685
687
 
975
977
                userid,
976
978
                pageid,
977
979
                referer,
978
 
                user_agent
979
 
                )
980
 
           )
 
980
                user_agent))
981
981
 
982
982
 
983
983
http = wsgi.ServerType(
1015
1015
class MainLaunchpadPublication(LaunchpadBrowserPublication):
1016
1016
    """The publication used for the main Launchpad site."""
1017
1017
 
1018
 
# ---- blueprint
1019
 
 
1020
 
class BlueprintBrowserRequest(LaunchpadBrowserRequest):
1021
 
    implements(canonical.launchpad.layers.BlueprintLayer)
1022
 
 
1023
 
class BlueprintPublication(LaunchpadBrowserPublication):
1024
 
    """The publication used for the Blueprint site."""
1025
 
 
1026
 
# ---- code
1027
 
 
1028
 
class CodePublication(LaunchpadBrowserPublication):
1029
 
    """The publication used for the Code site."""
1030
 
 
1031
 
class CodeBrowserRequest(LaunchpadBrowserRequest):
1032
 
    implements(canonical.launchpad.layers.CodeLayer)
1033
 
 
1034
 
# ---- translations
1035
 
 
1036
 
class TranslationsPublication(LaunchpadBrowserPublication):
1037
 
    """The publication used for the Translations site."""
1038
 
 
1039
 
class TranslationsBrowserRequest(LaunchpadBrowserRequest):
1040
 
    implements(canonical.launchpad.layers.TranslationsLayer)
1041
 
 
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')
1048
 
 
1049
 
# ---- bugs
1050
 
 
1051
 
class BugsPublication(LaunchpadBrowserPublication):
1052
 
    """The publication used for the Bugs site."""
1053
 
 
1054
 
class BugsBrowserRequest(LaunchpadBrowserRequest):
1055
 
    implements(canonical.launchpad.layers.BugsLayer)
1056
 
 
1057
 
# ---- answers
1058
 
 
1059
 
class AnswersPublication(LaunchpadBrowserPublication):
1060
 
    """The publication used for the Answers site."""
1061
 
 
1062
 
class AnswersBrowserRequest(LaunchpadBrowserRequest):
1063
 
    implements(canonical.launchpad.layers.AnswersLayer)
1064
 
 
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')
1071
 
 
1072
1018
 
1073
1019
class AccountPrincipalMixin:
1074
1020
    """Mixin for publication that works with person-less accounts."""
1344
1290
 
1345
1291
class PublicXMLRPCPublication(LaunchpadBrowserPublication):
1346
1292
    """The publication used for public XML-RPC requests."""
 
1293
 
1347
1294
    def handleException(self, object, request, exc_info, retry_allowed=True):
1348
1295
        LaunchpadBrowserPublication.handleException(
1349
 
                self, object, request, exc_info, retry_allowed
1350
 
                )
 
1296
                self, object, request, exc_info, retry_allowed)
1351
1297
        OpStats.stats['xml-rpc faults'] += 1
1352
1298
 
1353
1299
    def endRequest(self, request, object):
1493
1439
    factories = [
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),
1507
1447
        ]
1508
1448
 
1509
1449
    if config.launchpad.enable_test_openid_provider: