launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #26973
[Merge] ~cjwatson/launchpad:fix-archive-auth-inactive-person into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:fix-archive-auth-inactive-person into launchpad:master.
Commit message:
Fix ArchiveAuthTokenSet.deactivateNamedTokensForArchive
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/401862
`ResultSet.set` doesn't preserve the joins from `ArchiveAuthToken.getByArchive`. A subselect is the easiest way to fix this.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:fix-archive-auth-inactive-person into launchpad:master.
diff --git a/lib/lp/soyuz/model/archiveauthtoken.py b/lib/lp/soyuz/model/archiveauthtoken.py
index 90c753c..c1c6ecd 100644
--- a/lib/lp/soyuz/model/archiveauthtoken.py
+++ b/lib/lp/soyuz/model/archiveauthtoken.py
@@ -162,4 +162,10 @@ class ArchiveAuthTokenSet:
def deactivateNamedTokensForArchive(self, archive, names):
"""See `IArchiveAuthTokenSet`."""
tokens = self.getActiveNamedTokensForArchive(archive, names)
+ # Push this down to a subselect so that `ResultSet.set` works
+ # properly.
+ tokens = Store.of(archive).find(
+ ArchiveAuthToken,
+ ArchiveAuthToken.id.is_in(
+ tokens.get_select_expr(ArchiveAuthToken.id)))
tokens.set(date_deactivated=UTC_NOW)