示例#1
0
文件: policy.py 项目: jab/giblets
 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
示例#2
0
文件: policy.py 项目: jab/giblets
 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
示例#3
0
文件: policy.py 项目: jab/giblets
    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))
示例#4
0
文件: policy.py 项目: jab/giblets
    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)
示例#5
0
文件: policy.py 项目: jab/giblets
    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
示例#6
0
文件: policy.py 项目: jab/giblets
 def is_component_enabled(self, component):
     """
     returns False unless the component specified has been 
     enabled.
     """
     return _component_id(component) in self.whitelist