#-*- coding: utf-8 -*-


import yaml


class ConfigFileError(Exception):
    pass


class Confiture(object):

    def __init__(self, tpl_file=None):
        self._tpl_file = tpl_file
        self.__tpl = None
        self.__parse()
        self.config = None


    @property
    def tpl_file(self):
        return self._tpl_file


    @tpl_file.setter
    def tpl_file(self, path):
        self._tpl_file = path
        self.__parse()


    def __parse(self):
        try:
            with open(self._tpl_file, 'r') as ymlfile:
                self.__tpl = yaml.load(ymlfile)
        except IOError:
            raise ConfigFileError("*** File {0} not found -- aborting".format(self._tpl_file))


    def __check_required_fields(self, tpl, config):
        for section in tpl.keys():
            if section not in config.keys():
                raise ConfigFileError("*** {0} field not found -- aborting".format(section))
            field = tpl[section]
            if isinstance(field, dict):
                self.__check_required_fields(field, config[section])


    def check(self, config_path):
        if self.__tpl is None:
            raise ConfigFileError("*** you must load a template file first -- aborting")
        try:
            with open(config_path, 'r') as ymlfile:
                self.config = yaml.load(ymlfile)
        except IOError:
            raise ConfigFileError("*** File {0} not found -- aborting".format(self.__config_file))
        self.__check_required_fields(self.__tpl, config)


    def check_and_get(self, config_path):
        self.check()
        return self.config

@@ -1433,26 +1433,19 @@
 mat(
-self.__
 config_
-file
+path
 ))%0A 
@@ -1488,24 +1488,29 @@
 self.__tpl, 
+self.
 config)%0A%0A%0A  
@@ -1541,32 +1541,32 @@
 , config_path):%0A
-
         self.che
@@ -1568,16 +1568,27 @@
 f.check(
+config_path
 )%0A      

Remove lumps