l.c.s.BranchOpenPolicy : class documentation

Part of lp.codehosting.safe_open View In Hierarchy

Known subclasses: lp.codehosting.codeimport.worker.CodeImportBranchOpenPolicy, lp.codehosting.puller.worker.BranchMirrorerPolicy, lp.codehosting.safe_open.BlacklistPolicy, lp.codehosting.safe_open.SingleSchemePolicy, lp.codehosting.safe_open.WhitelistPolicy

Policy on how to open branches.

In particular, a policy determines which branches are safe to open by checking their URLs and deciding whether or not to follow branch references.

Method shouldFollowReferences Whether we traverse references when mirroring.
Method transformFallbackLocation Validate, maybe modify, 'url' to be used as a stacked-on location.
Method checkOneURL Check the safety of the source URL.
def shouldFollowReferences(self):
Whether we traverse references when mirroring.

Subclasses must override this method.

If we encounter a branch reference and this returns false, an error is raised.

ReturnsA boolean to indicate whether to follow a branch reference.
def transformFallbackLocation(self, branch, url):
Validate, maybe modify, 'url' to be used as a stacked-on location.
ParametersbranchThe branch that is being opened.
urlThe URL that the branch provides for its stacked-on location.
Returns(new_url, check) where 'new_url' is the URL of the branch to actually open and 'check' is true if 'new_url' needs to be validated by checkAndFollowBranchReference.
def checkOneURL(self, url):
Check the safety of the source URL.

Subclasses must override this method.

ParametersurlThe source URL to check.
RaisesBadUrlsubclasses are expected to raise this or a subclass when it finds a URL it deems to be unsafe.
API Documentation for Launchpad, generated by pydoctor at 2019-07-09 00:00:06.