← Back to team overview

launchpad-reviewers team mailing list archive

Re: [Merge] lp:~maxiberta/launchpad/named-auth-tokens-htaccess into lp:launchpad

 


Diff comments:

> 
> === modified file 'lib/lp/archivepublisher/scripts/generate_ppa_htaccess.py'
> --- lib/lp/archivepublisher/scripts/generate_ppa_htaccess.py	2014-10-29 06:04:09 +0000
> +++ lib/lp/archivepublisher/scripts/generate_ppa_htaccess.py	2016-07-13 20:42:37 +0000
> @@ -274,6 +275,22 @@
>              *extra_expr)
>          return new_ppa_tokens
>  
> +    def getDeactivatedNamedTokens(self, since=None):
> +        """Return result set of named tokens deactivated since given time."""
> +        now = datetime.now(pytz.UTC)
> +
> +        store = IStore(ArchiveAuthToken)
> +        extra_expr = []
> +        if since:
> +            extra_expr = [ArchiveAuthToken.date_deactivated >= since]
> +        tokens = store.find(
> +            ArchiveAuthToken,
> +            ArchiveAuthToken.name != None,
> +            ArchiveAuthToken.date_deactivated != None,
> +            ArchiveAuthToken.date_deactivated <= now,

date_expires has a specific reason to be set in the future, but named tokens are only ever revoked immediately in practice.  That said, it doesn't do any particular harm to keep these conditions so I don't mind if you prefer to.

> +            *extra_expr)
> +        return tokens
> +
>      def getNewPrivatePPAs(self, since=None):
>          """Return the recently created private PPAs."""
>          store = IStore(Archive)


-- 
https://code.launchpad.net/~maxiberta/launchpad/named-auth-tokens-htaccess/+merge/300002
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.


References