コード例 #1
0
def loadINIFileTemplate(templatePaths):
    ''' Load an INI file and template data so it would display correctly.
    Is called with loadINIFileConfig(configPath)
    
    :param templatesPaths: A path, or list of paths relative to 'src/config'
    :return: A dicts of the template
    '''
    if type(templatePaths) == str or type(templatePaths) == unicode:
        templatePaths= [templatePaths]

    iniTemplate = getINITemplate(templatePaths)
    
    try:
        for section in iniTemplate.keys():
            for item in iniTemplate[section].keys():
                print iniTemplate[section][item]
                iniTemplate[section][item] = json.loads(iniTemplate[section][item])
    except ValueError:
        raise ParsingTemplateException()
        
    return iniTemplate
コード例 #2
0
 def _loadConfigVariableTemplate(self,value):
     pluginName = self.__class__.__name__
     path = os.path.join("plugins",pluginName + ".ini")
     configDict = getINITemplate(path)
     return json.loads(configDict["plugins."+pluginName][value.lower()])[1]