Exemplo n.º 1
0
 def _gen_fileconfig(self):
     config = OrderedDict({self.SELF_SECTION: OrderedDict()})
     for name, item in self.loweritems():
         if self.is_section(name):
             fc = self._to_fileconfig(item, name)
             config.update(fc)
         else:
             fv = self._to_filevalue(item.get())
             config[self.SELF_SECTION][name] = fv
     return config
Exemplo n.º 2
0
 def _to_fileconfig(self, section, section_name):
     config = OrderedDict()
     for name, item in section.loweritems():
         if section.is_section(name):
             sub_name = '{0}{1}{2}'.format(section_name, self.SECTION_SEP,
                                           name)
             fc = self._to_fileconfig(item, sub_name)
             config.update(fc)
         else:
             fv = self._to_filevalue(item.get())
             config.setdefault(section_name, OrderedDict())[name] = fv
     return config