l.c.r.BranchRewriter : class documentation

Part of lp.codehosting.rewrite View In Hierarchy

No class docstring
Method __init__
Method rewriteLine Rewrite 'resource_location' to a more concrete location.
Method _codebrowse_url Undocumented
Method _getBranchIdAndTrailingPath Return the branch id and trailing path for 'location'.
def __init__(self, logger, _now=None):
ParametersloggerLogger that messages about what the rewriter is doing will be sent to.
proxyA blocking proxy for a branchfilesystem endpoint.
def _codebrowse_url(self, path):
Undocumented
def _getBranchIdAndTrailingPath(self, location):
Return the branch id and trailing path for 'location'.

In addition this method returns whether the answer can from the cache or from the database.

def rewriteLine(self, resource_location):
Rewrite 'resource_location' to a more concrete location.

We use the 'translatePath' BranchFileSystemClient method. There are three cases:

  1. The request is for something within the .bzr directory of a branch.

    In this case we rewrite the request to the location from which branches are served by ID.

  2. The request is for something within a branch, but not the .bzr directory.

    In this case, we hand the request off to codebrowse.

  3. The branch is not found. Two sub-cases: the request is for a product control directory or the we don't know how to translate the path.

    In both these cases we return 'NULL' which indicates to Apache that we don't know how to rewrite the request (and so it should go on to generate a 404 response).

Other errors are allowed to propagate, on the assumption that the caller will catch and log them.

API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.