From 01ff45c595e57c72fc4c7a64e87d58b458b41f33 Mon Sep 17 00:00:00 2001
From: Jim Fulton <jim@zope.com>
Date: Sun, 18 Mar 2007 18:48:41 +0000
Subject: [PATCH] Fixed a bug: It wasn't possible to give options on the
 command line for sections not defined in a configuration file.

---
 CHANGES.txt                 |  9 +++++++++
 src/zc/buildout/buildout.py |  2 +-
 src/zc/buildout/tests.py    | 18 ++++++++++++++++++
 3 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index 4205ac4..ae41390 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -11,6 +11,15 @@ priorities include:
 Change History
 **************
 
+1.0.0b23 (2007-03-??)
+=====================
+
+Bugs Fixed
+----------
+
+- It wasn't possible to give options on the command line for sections
+  not defined in a configuration file.
+
 1.0.0b22 (2007-03-15)
 =====================
 
diff --git a/src/zc/buildout/buildout.py b/src/zc/buildout/buildout.py
index 2e5b335..2687065 100644
--- a/src/zc/buildout/buildout.py
+++ b/src/zc/buildout/buildout.py
@@ -105,7 +105,7 @@ class Buildout(UserDict.DictMixin):
         for (section, option, value) in cloptions:
             options = data.get(section)
             if options is None:
-                options = self[section] = {}
+                options = data[section] = {}
             options[option] = value
                 # The egg dire
 
diff --git a/src/zc/buildout/tests.py b/src/zc/buildout/tests.py
index 63c8b6c..ea5f53e 100644
--- a/src/zc/buildout/tests.py
+++ b/src/zc/buildout/tests.py
@@ -395,6 +395,24 @@ Now, finally, let's test _get_version:
 
     """
 
+def create_sections_on_command_line():
+    """
+    >>> write('buildout.cfg',
+    ... '''
+    ... [buildout]
+    ... parts =
+    ... x = ${foo:bar}
+    ... ''')
+
+    >>> print system(buildout + ' foo:bar=1 -vD'), # doctest: +ELLIPSIS
+    zc.buildout.easy_install: Installing ['zc.buildout', 'setuptools']
+    ...
+    [foo]
+    bar = 1
+    ...
+    
+    """
+
 # Why?
 ## def error_for_undefined_install_parts():
 ##     """
-- 
2.30.9