cubicweb/pyramid/__init__.py
branch3.25
changeset 12137 4db0f2251960
parent 12101 3fd9c12a4426
child 12186 36f1c7ab9010
--- a/cubicweb/pyramid/__init__.py	Wed Apr 05 14:42:30 2017 +0200
+++ b/cubicweb/pyramid/__init__.py	Fri Apr 07 15:23:38 2017 +0200
@@ -226,7 +226,11 @@
     config.registry['cubicweb.registry'] = repo.vreg
 
     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)):
         config.include('cubicweb.pyramid.defaults')