Commit 5a6040c3 authored by Julien Cristau's avatar Julien Cristau
Browse files

[hooks] use internal_cnx instead of internal_session

New in cubicweb 3.19
parent 70a8b5152aad
......@@ -20,7 +20,7 @@ classifiers = [
'Programming Language :: JavaScript',
]
__depends__ = {'cubicweb': '>= 3.15.0',
__depends__ = {'cubicweb': '>= 3.19.0',
'pycrypto': None,
'PIL': None,
}
......
......@@ -8,7 +8,7 @@ Homepage: http://www.cubicweb.org/project/cubicweb-forgotpwd
Package: cubicweb-forgotpwd
Architecture: all
Depends: cubicweb-common (>= 3.9.0), python-crypto, python-imaging
Depends: cubicweb-common (>= 3.19.0), python-crypto, python-imaging
Description: password recovery component for the CubicWeb framework
This CubicWeb component provides password recovery functionnality.
.
......
......@@ -25,13 +25,10 @@ class ServerStartupHook(hook.Hook):
# XXX use named args and inner functions to avoid referencing globals
# which may cause reloading pb
def cleaning_revocation_key(repo, now=datetime.now):
session = repo.internal_session()
try:
session.execute('DELETE Fpasswd F WHERE F revocation_date < %(date)s',
with repo.internal_cnx() as cnx:
cnx.execute('DELETE Fpasswd F WHERE F revocation_date < %(date)s',
{'date': now()})
session.commit()
finally:
session.close()
cnx.commit()
# run looping task often enough to purge pwd-reset requests
limit = self.repo.vreg.config['revocation-limit'] * 60
self.repo.looping_task(limit, cleaning_revocation_key, self.repo)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment