diff --git a/gramps/webapp/modules_checkpoint.py b/gramps/webapp/modules_checkpoint.py new file mode 100644 index 000000000..330138905 --- /dev/null +++ b/gramps/webapp/modules_checkpoint.py @@ -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]