~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/services/webapp/servers.py

  • Committer: William Grant
  • Date: 2012-01-03 07:30:21 UTC
  • mto: This revision was merged to the branch mainline in revision 14621.
  • Revision ID: william.grant@canonical.com-20120103073021-qvprj6kbnpg0h1qv
Update a few templates.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2009-2012 Canonical Ltd.  This software is licensed under the
 
1
# Copyright 2009-2011 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
# pylint: disable-msg=W0231,E1002
1066
1066
    """The publication used for the main Launchpad site."""
1067
1067
 
1068
1068
 
 
1069
class AccountPrincipalMixin:
 
1070
    """Mixin for publication that works with person-less accounts."""
 
1071
 
 
1072
    def getPrincipal(self, request):
 
1073
        """Return the authenticated principal for this request.
 
1074
 
 
1075
        This is only necessary because, unlike in LaunchpadBrowserPublication,
 
1076
        here we want principals representing personless accounts to be
 
1077
        returned, so that personless accounts can use our OpenID server.
 
1078
        """
 
1079
        auth_utility = getUtility(IPlacelessAuthUtility)
 
1080
        principal = auth_utility.authenticate(request)
 
1081
        if principal is None:
 
1082
            principal = auth_utility.unauthenticatedPrincipal()
 
1083
            assert principal is not None, "Missing unauthenticated principal."
 
1084
        return principal
 
1085
 
 
1086
 
1069
1087
# ---- feeds
1070
1088
 
1071
1089
class FeedsPublication(LaunchpadBrowserPublication):