l.s.w.p.LaunchpadBrowserPublication(zope.app.publication.browser.BrowserPublication) : class documentation

Part of lp.services.webapp.publication View In Hierarchy

Known subclasses: lp.services.webapp.servers.FeedsPublication, lp.services.webapp.servers.MainLaunchpadPublication, lp.services.webapp.servers.ProtocolErrorPublication, lp.services.webapp.servers.PublicXMLRPCPublication, lp.services.webapp.servers.TestOpenIDBrowserPublication, lp.services.webapp.servers.WebServicePublication

Subclass of z.a.publication.BrowserPublication that removes ZODB.

This subclass undoes the ZODB-specific things in ZopePublication, a superclass of z.a.publication.BrowserPublication.

Method __init__ Undocumented
Method annotateTransaction See zope.app.publication.zopepublication.ZopePublication.
Method getDefaultTraversal Undocumented
Method getApplication Undocumented
Method beforeTraversal Undocumented
Method getPrincipal Return the authenticated principal for this request.
Method maybeRestrictToTeam Undocumented
Method getNonRestrictedURL Returns the non-restricted version of the request URL.
Method constructPageID Given a view, figure out what its page ID should be.
Method callObject See zope.publisher.interfaces.IPublication.
Method afterCall See zope.publisher.interfaces.IPublication.
Method finishReadOnlyRequest Hook called at the end of a read-only request.
Method callTraversalHooks We don't want to call _maybePlacefullyAuthenticate as does
Method afterTraversal See zope.publisher.interfaces.IPublication.
Method handleException Undocumented
Method beginErrorHandlingTransaction Hook for when a new view is started to handle an exception.
Method endRequest Undocumented
Method _maybePlacefullyAuthenticate This should never be called because we've excised it in
def __init__(self, db):
Undocumented
def annotateTransaction(self, txn, request, ob):
See zope.app.publication.zopepublication.ZopePublication.

We override the method to simply save the authenticated user id in the transaction.

def getDefaultTraversal(self, request, ob):
Undocumented
def getApplication(self, request):
Undocumented
def beforeTraversal(self, request):
Undocumented
def getPrincipal(self, request):
Return the authenticated principal for this request.

If there is no authenticated principal or the principal represents a personless account, return the unauthenticated principal.

def maybeRestrictToTeam(self, request):
Undocumented
def getNonRestrictedURL(self, request):
Returns the non-restricted version of the request URL.

The intended use is for determining the equivalent URL on the production Launchpad instance if a user accidentally ends up on a restrict_to_team Launchpad instance.

If a non-restricted URL can not be determined, None is returned.

def constructPageID(self, view, context, view_names=()):
Given a view, figure out what its page ID should be.

This provides a hook point for subclasses to override.

def callObject(self, request, ob):
See zope.publisher.interfaces.IPublication.

Our implementation make sure that no result is returned on redirect.

It also sets the launchpad.userid and launchpad.pageid WSGI environment variables.

def afterCall(self, request, ob):
See zope.publisher.interfaces.IPublication.

Our implementation calls self.finishReadOnlyRequest(), which by default aborts the transaction, for read-only requests. Because of this we cannot chain to the superclass and implement the whole behaviour here.

def finishReadOnlyRequest(self, request, ob, txn):
Hook called at the end of a read-only request.

By default it abort()s the transaction, but subclasses may need to commit it instead, so they must overwrite this.

def callTraversalHooks(self, request, ob):
We don't want to call _maybePlacefullyAuthenticate as does zopepublication
def afterTraversal(self, request, ob):
See zope.publisher.interfaces.IPublication.

This hook does not invoke our parent's afterTraversal hook in zopepublication.py because we don't want to call _maybePlacefullyAuthenticate.

def _maybePlacefullyAuthenticate(self, request, ob):
This should never be called because we've excised it in favor of dealing with auth in events; if it is called for any reason, raise an error
def handleException(self, object, request, exc_info, retry_allowed=True):
Undocumented
def beginErrorHandlingTransaction(self, request, ob, note):
Hook for when a new view is started to handle an exception.

We need to add an additional behaviour to the usual Zope behaviour. We must restart the request timer. Otherwise we can get OOPS errors from our exception views inappropriately.

def endRequest(self, request, object):
Undocumented
API Documentation for Launchpad, generated by pydoctor at 2019-09-23 00:00:04.