def register_ctype(self, name, **kwargs): if name in self.registry: self.registry[name].update(kwargs) else: self.registry[name] = kwargs if kwargs.get('factory', None): clazz = kwargs['factory'] path, clazz = ".".join(clazz.split(".")[:-1]), clazz.split(".")[-1] exec("from %s import %s" % (path, clazz)) Registry.register(name, eval(clazz))
def setup_class(self): self.config = testing.setUp() self.root = BaseFolder("root") self.root.__name__ = 'root' self.f0 = BaseFolder("f0") self.f1 = BaseFolder("f1") self.x0 = TestContent("x0") self.x1 = TestContent("x1") self.f0.add_content(self.x0) self.f0.add_content(self.x1) self.root.add_content(self.f0) self.root.add_content(self.f1) Registry.register('testcontent', TestContent)