projects
/
cascardo
/
ipsilon.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make it possible to use PluginLoader without store
[cascardo/ipsilon.git]
/
ipsilon
/
providers
/
openid
/
store.py
diff --git
a/ipsilon/providers/openid/store.py
b/ipsilon/providers/openid/store.py
index
7c637d4
..
bf2898c
100644
(file)
--- a/
ipsilon/providers/openid/store.py
+++ b/
ipsilon/providers/openid/store.py
@@
-65,26
+65,35
@@
class OpenIDStore(Store, OpenIDStoreInterface):
return True
return True
+ def _cleanup(self):
+ res1 = self.cleanupNonces()
+ res2 = self.cleanupAssociations()
+ return res1 + res2
+
def cleanupNonces(self):
nonces = self.get_unique_data('nonce')
def cleanupNonces(self):
nonces = self.get_unique_data('nonce')
+ cleaned = 0
for iden in nonces:
if nonces[iden]['timestamp'] < (time() - NonceSKEW):
for iden in nonces:
if nonces[iden]['timestamp'] < (time() - NonceSKEW):
+ cleaned += 1
self.del_unique_data('nonce', iden)
self.del_unique_data('nonce', iden)
+ return cleaned
def cleanupAssociations(self):
assocs = self.get_unique_data('association')
def cleanupAssociations(self):
assocs = self.get_unique_data('association')
+ cleaned = 0
for iden in assocs:
if ((int(assocs[iden]['issued']) + int(assocs[iden]['lifetime']))
< time()):
for iden in assocs:
if ((int(assocs[iden]['issued']) + int(assocs[iden]['lifetime']))
< time()):
+ cleaned += 1
self.del_unique_data('association', iden)
self.del_unique_data('association', iden)
+ return cleaned
def _initialize_schema(self):
q = self._query(self._db, 'association', UNIQUE_DATA_TABLE,
trans=False)
q.create()
def _initialize_schema(self):
q = self._query(self._db, 'association', UNIQUE_DATA_TABLE,
trans=False)
q.create()
- q = self._query(self._db, 'openid_extensions', OPTIONS_TABLE,
- trans=False)
- q.create()
+ q._con.close() # pylint: disable=protected-access
def _upgrade_schema(self, old_version):
if old_version == 1:
def _upgrade_schema(self, old_version):
if old_version == 1: