def load_module(self, module): """Load a child module""" value = self._value() if value == NOTSET: raise SettingNotSet("%s.%s", self.group.key, self.key) else: return load_module("%s.%s" % (value, module))
def load_module(self, module): """Load a child module""" value = self._value() if value == NOTSET: raise SettingNotSet(f"{self.group.key}.{self.key}") else: return load_module("%s.%s" % (value, module))
def to_python(self, value): if value in (NOTSET, ''): v = {} # TODO this was probably not a good idea else: try: v = load_module(value) except ImportError: v = '' return v
def to_python(self, value): if value == NOTSET: v = {} else: try: v = load_module(value) except ImportError: v = '' return v
def load_module(self, module): """Load a child module""" value = self._value() if value == NOTSET: raise SettingNotSet("{}.{}".format( self.group.key, self.key, )) else: return load_module("%s.%s" % (value, module))
def to_python(self, value): if value == NOTSET: v = {} else: v = load_module(value) return v