Commit 6bc23d58 authored by Jim Fulton's avatar Jim Fulton

Fixed: parse didn't handle section expressions (cuz they didn't

       exist in that branch).  I don't really expect people to use
       conditional sections with parse, but behavior should be
       consistent.
parent 2d6cae1f
......@@ -1110,7 +1110,7 @@ class Buildout(DictMixin):
import textwrap
sections = zc.buildout.configparser.parse(
StringIO(textwrap.dedent(data)), '')
StringIO(textwrap.dedent(data)), '', _default_globals)
for name in sections:
if name in self._raw:
raise KeyError("Section already exists", name)
......
......@@ -2895,6 +2895,26 @@ def buildout_honors_umask():
>>> tmp = os.umask(orig_umask) # Reset umask to the original value.
"""
def parse_with_section_expr():
r"""
>>> class Recipe:
... def __init__(self, buildout, *_):
... buildout.parse('''
... [foo : sys.version_info[0] > 0]
... x = 1
... ''')
>>> buildout = zc.buildout.testing.Buildout()
>>> buildout.parse('''
... [foo : sys.version_info[0] > 0]
... x = 1
... ''')
>>> buildout.print_options()
[foo]
x = 1
"""
if sys.platform == 'win32':
del buildout_honors_umask # umask on dohs is academic
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment