Antoine Millet committed c8c5e03

Fixed error when a section is included by an external file

A new iterflatchildren method has been created on ConfigSection to keep
API compatibility. This method is now used by the parser to include
external sections.

  • Participants
  • Parent commits d9b5425

Comments (0)

Files changed (2)

File dotconf/

     def p_section_content_include(self, p):
         """section_content : section_content INCLUDE TEXT"""
         for external in self._external_opener(p[3]):
-            p[1] += list(external.iterchildren())
+            p[1] += list(external.iterflatchildren())
         p[0] = p[1]
     def p_section(self, p):

File dotconf/

     def iterchildren(self):
         """ Iterate over all children of this section.
+        """
+        return chain(self._values.itervalues(), self._subsections.itervalues())
+    def iterflatchildren(self):
+        """ Iterate over all children of this section, not grouping sections.
             This is used for the include feature of parser.
-        return chain(self._values.itervalues(), self._subsections.itervalues())
+        return chain(self._values.itervalues(), *self._subsections.itervalues())
     def iteritems(self):
         """ Like :meth:``iterchildren`` but return a couple (key, child).