def is_component_enabled(self, component): """ returns True unless the component specified has been disabled. """ if _component_id(component) in self.blacklist: return False return True
def is_component_enabled(self, component): enabled = False comp_id = _component_id(component) for (pat, state) in self.patterns: if pat.match(comp_id) is not None: enabled = state break return enabled
def enable_component(self, component): """ Allow the component specified to be activated for this ComponentManager. component may be a full class name string 'foo.bar.Quux' a Component type or an instance of a Component. """ self.whitelist.add(_component_id(component))
def disable_component(self, component): """ Do not allow the component specified to be activated for this ComponentManager. component may be a full class name string 'foo.bar.Quux' a Component type or an instance of a Component. """ component_id = _component_id(component) self.blacklist.add(component_id)
def disable_component(self, component): """ Do not allow the component specified to be activated for this ComponentManager. component may be a full class name string 'foo.bar.Quux' a Component type or an instance of a Component. """ try: self.whitelist.remove(_component_id(component)) except KeyError: pass
def is_component_enabled(self, component): """ returns False unless the component specified has been enabled. """ return _component_id(component) in self.whitelist