Commit 2ee78718 authored by Denis Laxalde's avatar Denis Laxalde
Browse files

[pyramid] Avoid shutting down the repository at exit if it's already shutting down

For install `cubicweb-ctl pyramid` command will explicitly call
`repo.shutdown()` so the atexit hook is redundant. Prevent the latter to be
executed when the repository is already shutting down (otherwise one gets an
assertion error).

--HG--
branch : 3.25
parent 6069ee7d4824
...@@ -226,7 +226,11 @@ def includeme(config): ...@@ -226,7 +226,11 @@ def includeme(config):
config.registry['cubicweb.registry'] = repo.vreg config.registry['cubicweb.registry'] = repo.vreg
if cwconfig.mode != 'test': if cwconfig.mode != 'test':
atexit.register(repo.shutdown) @atexit.register
def shutdown_repo():
if repo.shutting_down:
return
repo.shutdown
if asbool(config.registry.settings.get('cubicweb.defaults', True)): if asbool(config.registry.settings.get('cubicweb.defaults', True)):
config.include('cubicweb.pyramid.defaults') config.include('cubicweb.pyramid.defaults')
......
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