From d537d4b69b4547814f2d01bc18ce2c472b978647 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 2 May 2010 21:18:09 +0200 Subject: Added log module --- curunir.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'curunir.py') diff --git a/curunir.py b/curunir.py index 7f6a699..99fd77f 100644 --- a/curunir.py +++ b/curunir.py @@ -6,14 +6,18 @@ from config import config class ModuleManager: def __init__(self, config): self.config = config - self.modules = [] + self.modules = {} for mod in config['modules']: - self.load(mod) + self.get(mod) - def load(self, name): - mod = __import__('modules.' + name, globals(), locals(), ['Module']) - self.modules.append(mod.Module(self)) + def get(self, name): + if not name in self.modules: + mod = __import__('modules.' + name, globals(), locals(), ['Module']) + self.modules[name] = mod.Module(self) + + return self.modules[name] + run = True -- cgit v1.2.3