launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #17386
[Merge] lp:~wgrant/launchpad/timelimitedtoken-sha256-compat into lp:launchpad
William Grant has proposed merging lp:~wgrant/launchpad/timelimitedtoken-sha256-compat into lp:launchpad.
Commit message:
TimeLimitedToken lookup now copes with the database being SHA-256'd.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~wgrant/launchpad/timelimitedtoken-sha256-compat/+merge/232884
TimeLimitedToken lookup now copes with the database being SHA-256'd.
--
https://code.launchpad.net/~wgrant/launchpad/timelimitedtoken-sha256-compat/+merge/232884
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/timelimitedtoken-sha256-compat into lp:launchpad.
=== modified file 'lib/lp/services/librarianserver/db.py'
--- lib/lp/services/librarianserver/db.py 2013-06-20 05:50:00 +0000
+++ lib/lp/services/librarianserver/db.py 2014-09-01 12:37:28 +0000
@@ -8,6 +8,8 @@
'Library',
]
+import hashlib
+
from storm.expr import (
And,
SQL,
@@ -59,8 +61,9 @@
store = session_store()
token_found = store.find(TimeLimitedToken,
SQL("age(created) < interval '1 day'"),
- TimeLimitedToken.token == token,
- TimeLimitedToken.path==path).is_empty()
+ TimeLimitedToken.token.is_in(
+ (token, hashlib.sha256(token).hexdigest())),
+ TimeLimitedToken.path == path).is_empty()
store.reset()
if token_found:
raise LookupError("Token stale/pruned/path mismatch")
Follow ups