aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodney Ewing <ewing.rj@gmail.com>2013-06-26 12:43:12 -0700
committerChristopher Allan Webber <cwebber@dustycloud.org>2013-07-03 13:49:16 -0500
commit664ce3bfaea6778c3fbca613ab66da881559f4c3 (patch)
tree59a7918fcf5a5897e4a8e827e18a2c1b37ce93ed
parentb01bff8b3c973887fd7063723ee1fb89d6f40a60 (diff)
downloadmediagoblin-664ce3bfaea6778c3fbca613ab66da881559f4c3.tar.lz
mediagoblin-664ce3bfaea6778c3fbca613ab66da881559f4c3.tar.xz
mediagoblin-664ce3bfaea6778c3fbca613ab66da881559f4c3.zip
fixed openid store cleanupAssociations
-rw-r--r--mediagoblin/plugins/openid/store.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/mediagoblin/plugins/openid/store.py b/mediagoblin/plugins/openid/store.py
index b54cf5c8..8f9a7012 100644
--- a/mediagoblin/plugins/openid/store.py
+++ b/mediagoblin/plugins/openid/store.py
@@ -105,8 +105,6 @@ class SQLAlchemyOpenIDStore(OpenIDStore):
ononce.save()
return True
- # Need to test these cleanups, not sure if the expired Association query
- # will work
def cleanupNonces(self, _now=None):
if _now is None:
_now = int(time.time())
@@ -120,9 +118,10 @@ class SQLAlchemyOpenIDStore(OpenIDStore):
def cleanupAssociations(self):
now = int(time.time())
- expired = Association.query.filter(
- 'issued + lifetime' < now)
- count = expired.count()
- for each in expired:
- each.delete()
+ assoc = Association.query.all()
+ count = 0
+ for each in assoc:
+ if (each.lifetime + each.issued) <= now:
+ each.delete()
+ count = count + 1
return count