fixed openid store cleanupAssociations
This commit is contained in:
parent
b01bff8b3c
commit
664ce3bfae
@ -105,8 +105,6 @@ class SQLAlchemyOpenIDStore(OpenIDStore):
|
|||||||
ononce.save()
|
ononce.save()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# Need to test these cleanups, not sure if the expired Association query
|
|
||||||
# will work
|
|
||||||
def cleanupNonces(self, _now=None):
|
def cleanupNonces(self, _now=None):
|
||||||
if _now is None:
|
if _now is None:
|
||||||
_now = int(time.time())
|
_now = int(time.time())
|
||||||
@ -120,9 +118,10 @@ class SQLAlchemyOpenIDStore(OpenIDStore):
|
|||||||
|
|
||||||
def cleanupAssociations(self):
|
def cleanupAssociations(self):
|
||||||
now = int(time.time())
|
now = int(time.time())
|
||||||
expired = Association.query.filter(
|
assoc = Association.query.all()
|
||||||
'issued + lifetime' < now)
|
count = 0
|
||||||
count = expired.count()
|
for each in assoc:
|
||||||
for each in expired:
|
if (each.lifetime + each.issued) <= now:
|
||||||
each.delete()
|
each.delete()
|
||||||
|
count = count + 1
|
||||||
return count
|
return count
|
||||||
|
Loading…
x
Reference in New Issue
Block a user