changeset 19:8987867698ee

a bit more stubbing of .ini parsing
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 30 May 2011 10:55:55 -0700
parents d303a5883991
children 057ccfe310b2
files pyloader/factory.py tests/test.ini
diffstat 2 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/pyloader/factory.py	Fri May 27 19:12:56 2011 -0700
+++ b/pyloader/factory.py	Mon May 30 10:55:55 2011 -0700
@@ -4,6 +4,8 @@
 
 import loader
 import os
+from ConfigParser import InterpolationMissingOptionError
+from ConfigParser import InterpolationSyntaxError
 from ConfigParser import SafeConfigParser as ConfigParser
 
 __all__ = ['CircularReferenceError', 'PyFactory', 'IniFactory']
@@ -108,6 +110,14 @@
             name, path = section.split(':', 1)
             sect = config[name] = dict(path=path)
             for option in parser.options(section):
-                pass
+
+                if option in parser.defaults():
+                    # don't include the defaults
+                    continue
+                try:
+                    value = parser.get(section, option)
+                except (InterpolationMissingOptionError, InterpolationSyntaxError):
+                    value = parser.get(section, option, raw=True)
+                                                                
                 
                     
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test.ini	Mon May 30 10:55:55 2011 -0700
@@ -0,0 +1,6 @@
+[:%(here)s/objects.py:StringMunge]
+. = PRE
+delimeter = '!!!'
+callback = %(callback)s
+
+[callback:%(here)s/objects.py:stringsort]
\ No newline at end of file