l.a.s.g.HtaccessTokenGenerator(LaunchpadCronScript) : class documentation

Part of lp.archivepublisher.scripts.generate_ppa_htaccess View In Hierarchy

Helper class for generating .htaccess files for private PPAs.
Method add_my_options Add script command line options.
Method ensureHtaccess Generate a .htaccess for ppa.
Method generateHtpasswd Generate a htpasswd file for ppa`s `tokens.
Method replaceUpdatedHtpasswd Compare the new and the old htpasswd and replace if changed.
Method sendCancellationEmail Send an email to the person whose subscription was cancelled.
Method deactivateTokens Deactivate the given tokens.
Method deactivateInvalidTokens Deactivate tokens as necessary.
Method expireSubscriptions Expire subscriptions as necessary.
Method getTimeToSyncFrom Return the time we'll synchronize from.
Method getNewTokens Return result set of new tokens created since the given time.
Method getDeactivatedNamedTokens Return result set of named tokens deactivated since given time.
Method getNewPrivatePPAs Return the recently created private PPAs.
Method main Script entry point.
Method _getInvalidTokens Return all invalid tokens.

Inherited from LaunchpadCronScript:

Method __init__ Construct new LaunchpadScript.
Method get_last_activity Return the last activity, if any.
Method record_activity Record the successful completion of the script.

Inherited from LaunchpadScript (via LaunchpadCronScript):

Method handle_options Undocumented
Method name Enable subclasses to override with command-line arguments.
Method dbuser Enable subclasses to override with command-line arguments.
Method login Super-convenience method that avoids the import.
Method lockfilename Return lockfilename.
Method lockfilepath Undocumented
Method setup_lock Create lockfile.
Method lock_or_die Attempt to lock, and sys.exit(1) if the lock's already taken.
Method unlock Release the lock. Do this before going home.
Method run Actually run the script, executing zcml and initZopeless.
Method lock_and_run Call lock_or_die(), and then run() the script.
Method _init_zca Initialize the ZCA, this can be overridden for testing purposes.
Method _init_db Initialize the database transaction.
def add_my_options(self):
Add script command line options.
def ensureHtaccess(self, ppa):
Generate a .htaccess for ppa.
def generateHtpasswd(self, ppa):
Generate a htpasswd file for ppa`s `tokens.
ParametersppaThe context PPA (an IArchive).
ReturnsThe filename of the htpasswd file that was generated.
def replaceUpdatedHtpasswd(self, ppa, temp_htpasswd_file):
Compare the new and the old htpasswd and replace if changed.
ReturnsTrue if the file was replaced.
def sendCancellationEmail(self, token):
Send an email to the person whose subscription was cancelled.
def _getInvalidTokens(self):
Return all invalid tokens.

A token is invalid if it is active and the token owner is not a subscriber to the archive that the token is for. The subscription can be either direct or through a team.

def deactivateTokens(self, tokens, send_email=False):
Deactivate the given tokens.
ReturnsA set of PPAs affected by the deactivations.
def deactivateInvalidTokens(self, send_email=False):
Deactivate tokens as necessary.

If an active token for a PPA no longer has any subscribers, we deactivate the token.

Parameterssend_emailWhether to send a cancellation email to the owner of the token. This defaults to False to speed up the test suite.
Returnsthe set of ppas affected by token deactivations so that we can later update their htpasswd files.
def expireSubscriptions(self):
Expire subscriptions as necessary.

If an ArchiveSubscriber's date_expires has passed, then set its status to EXPIRED.

def getTimeToSyncFrom(self):
Return the time we'll synchronize from.

Any new PPAs or tokens created since this time will be used to generate passwords.

def getNewTokens(self, since=None):
Return result set of new tokens created since the given time.
def getDeactivatedNamedTokens(self, since=None):
Return result set of named tokens deactivated since given time.
def getNewPrivatePPAs(self, since=None):
Return the recently created private PPAs.
def main(self):
Script entry point.
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.