>From aabd5ddda35bdcf557d49b7615ad1bd8ad2daf90 Mon Sep 17 00:00:00 2001
From: Florian Friesdorf <flo@chaoflow.net>
Date: Mon, 19 Apr 2010 19:27:12 +0200
Subject: [PATCH 2/2] docstring for _open incl. temporary comments from analysis

---
 src/zc/buildout/buildout.py |   43 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/src/zc/buildout/buildout.py b/src/zc/buildout/buildout.py
index c13fbfe..6222f37 100644
--- a/src/zc/buildout/buildout.py
+++ b/src/zc/buildout/buildout.py
@@ -1272,6 +1272,49 @@ def _open(base, filename, seen, dl_options, override):
     """Open a configuration file and return the result as a dictionary,
 
     Recursively open other files based on buildout options found.
+
+
+    Notes from analyzing the code here and in Buildout.__init__:
+
+    override is use to update dl_options and passed on to recursive calls of
+    _open
+
+    dl_options is updated with values from override and passed on to recursive
+    calls of _open.
+
+    extends-cache defined in either dl_options or override is used as
+    extends_cache
+
+    _open is used in Buildout.__init__, where it always receives a copy of
+    data['buildout'] as dl_options, i.e. the implicit feature of updating
+    dl_options is not used.
+
+    _open is used by itself recursively, where it always uses the very same
+    dl_options. However, it also passes on override and updates dl_options each
+    time with override.
+
+    The only two keys that justifiy the dl_options and override parameters are
+    extends-cache and extends, and currently they are only used for
+    extends-cache.
+
+
+    current behaviour:
+    - extends-cache can be defined anywhere and is overruled in the expected
+      order: user_defaults, configuration file, command line
+    - extends currently is only processed if defined in the configuration file
+      we are opening, not if it is passed via dl_options or override, i.e it is
+      not used if defined in user_defaults or on the command line.
+
+
+    desired behaviour:
+    - extends should be possible on the command line modifying a definition in
+      the configuration file
+    - extends should be possible in user_defaults, resulting in user_defaults
+      being derived from processing its extends and then being discarded
+      (optional)
+    - _open should not work on any arguments, but only return data it extracted
+      from the file it is supposed to open, following extends from the
+      configuration file or once using an extends passed in as override
     """
     _update_section(dl_options, override)
     _dl_options = _unannotate_section(dl_options.copy())
-- 
1.6.6.2

