示例#1
0
    def load_sections(self):
        """
        This method will load all of the sections to the template.
        Each section will become its own attribute according to the template
        e.g. logon_username section will turn into t.logon_username which is type(t.logon_username) == Sections()
        """
        config = RawConfigParser()
        config.read(self.file_path)
        sections = config._sections

        for sec in sections:
            new_section = Section()
            new_section.set_name(sec)
            new_section.template = self
            for attr in sections[sec]:
                new_section.set_attribute(attr, sections[sec][attr])
            setattr(self, sec, new_section)