changeset 7:7c8f23eae311

discriminate on case
author Jeff Hammel <jhammel@mozilla.com>
date Wed, 24 Nov 2010 10:55:59 -0800
parents 09bed87f7fa4
children 81aed4352851
files martini/config.py martini/tests/test_config.txt
diffstat 2 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/martini/config.py	Wed Nov 24 10:49:37 2010 -0800
+++ b/martini/config.py	Wed Nov 24 10:55:59 2010 -0800
@@ -30,6 +30,7 @@
     
     def __init__(self, *conf, **kw):
         ConfigParser.__init__(self, kw.get('defaults',{}))
+        self.optionxform = str
         self.read(*conf)
     
     def __getitem__(self, section):
--- a/martini/tests/test_config.txt	Wed Nov 24 10:49:37 2010 -0800
+++ b/martini/tests/test_config.txt	Wed Nov 24 10:55:59 2010 -0800
@@ -102,3 +102,14 @@
      >>> munger.read("[Jeff Hammel]\naddress = 639 W. 173 St.\n Apt. 11D\n New York, NY  10032")
      >>> munger.get('Jeff Hammel', 'address')
      '639 W. 173 St.\nApt. 11D\nNew York, NY  10032'
+
+Test the ability to keep string case:
+
+     >>> munger = ConfigMunger()
+     >>> munger.read("[Foo]\nBar=fleem\nfOo=blah\nbAr=flu")
+     >>> munger.write()
+     [Foo]
+     Bar = fleem
+     bAr = flu
+     fOo = blah
+