# HG changeset patch
# User Jeff Hammel <jhammel@mozilla.com>
# Date 1307637368 25200
# Node ID b9d9a94bfa1979623e5cb4399486ba5852419848
# Parent  65609d7ba63dab78d8c2016bdf63b08a64beaa5f
override section now works

diff -r 65609d7ba63d -r b9d9a94bfa19 pyloader/factory.py
--- a/pyloader/factory.py	Thu Jun 09 09:29:06 2011 -0700
+++ b/pyloader/factory.py	Thu Jun 09 09:36:08 2011 -0700
@@ -8,6 +8,7 @@
 import loader
 import os
 import sys
+from copy import deepcopy
 from optparse import OptionParser
 from ConfigParser import InterpolationDepthError
 from ConfigParser import InterpolationMissingOptionError
@@ -183,7 +184,7 @@
                     if overridden_section in seen:
                         pass # TODO
                     create_section(overridden_section, iniconfig[overridden_section])
-                # TODO: sect = config[path].copy()
+                sect = deepcopy(config[path])
 
             if 'path' not in sect:
                 # add the path to section dict
diff -r 65609d7ba63d -r b9d9a94bfa19 tests/test.ini
--- a/tests/test.ini	Thu Jun 09 09:29:06 2011 -0700
+++ b/tests/test.ini	Thu Jun 09 09:36:08 2011 -0700
@@ -15,6 +15,6 @@
 [foo:@:fibonacci]
 
 [bar:fibonacci]
-n=1
+n=5
 
 [extended-fibonacci:@:four=4,five=5:fibonacci]
diff -r 65609d7ba63d -r b9d9a94bfa19 tests/test_ini.txt
--- a/tests/test_ini.txt	Thu Jun 09 09:29:06 2011 -0700
+++ b/tests/test_ini.txt	Thu Jun 09 09:36:08 2011 -0700
@@ -48,3 +48,9 @@
     '%(fibonacci)s'
     >>> [fib(i) for i in range(6)]
     ['one', 'one', 'two', 'three', 5, 8]
+
+Override a section with additional arguments, [bar:fibonacci], n=5::
+
+    >>> bar = inifactory.load('bar')
+    >>> bar # [1,1,2,3,5,8][5]
+    8