示例#1
0
文件: manager.py 项目: xinobi/OpenCue
 def sort_by_priority(a, b):
     priority_option = "priority"
     a_priority = 0
     b_priority = 0
     if config.has_option(a, priority_option):
         a_priority = config.getint(a, priority_option)
     if config.has_option(b, priority_option):
         b_priority = config.getint(b, priority_option)
     return cmp(b_priority, a_priority)
示例#2
0
 def load_all_plugins(cls):
     def section_priority(section_needing_key):
         priority_option = "priority"
         if config.has_option(section_needing_key, priority_option):
             return config.getint(section_needing_key, priority_option)
         return 0
     
     sections = sorted(config.sections(), key=section_priority)
     
     for section in sections:
         if section.startswith("plugin:"):
             if config.getint(section, "enable"):
                 logger.debug("Loading plugin '%s'" % section)
                 cls.load_plugin(config.get(section, "module"))
示例#3
0
文件: manager.py 项目: xinobi/OpenCue
    def load_all_plugins(cls):
        def sort_by_priority(a, b):
            priority_option = "priority"
            a_priority = 0
            b_priority = 0
            if config.has_option(a, priority_option):
                a_priority = config.getint(a, priority_option)
            if config.has_option(b, priority_option):
                b_priority = config.getint(b, priority_option)
            return cmp(b_priority, a_priority)

        sections = sorted(config.sections(), cmp=sort_by_priority)

        for section in sections:
            if section.startswith("plugin:"):
                if config.getint(section, "enable"):
                    logger.debug("Loading plugin '%s'" % section)
                    cls.load_plugin(config.get(section, "module"))
示例#4
0
 def section_priority(section_needing_key):
     priority_option = "priority"
     if config.has_option(section_needing_key, priority_option):
         return config.getint(section_needing_key, priority_option)
     return 0