DbDjango: method to checkpoint modules, to allow reloading Django
This commit is contained in:
parent
b615fcb93c
commit
f74f4942d5
13
gramps/webapp/modules_checkpoint.py
Normal file
13
gramps/webapp/modules_checkpoint.py
Normal file
@ -0,0 +1,13 @@
|
||||
import sys
|
||||
|
||||
class ModulesCheckpoint(object):
|
||||
def __init__(self):
|
||||
self.original = sys.modules.copy()
|
||||
|
||||
def reset(self):
|
||||
# clear modules:
|
||||
for key in list(sys.modules.keys()):
|
||||
del(sys.modules[key])
|
||||
# load previous:
|
||||
for key in self.original:
|
||||
sys.modules[key] = self.original[key]
|
Loading…
Reference in New Issue
Block a user