From 9da12232d4787ed71db428e27e094d9207d51248 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Sun, 20 Jan 2013 14:49:24 -0600 Subject: [PATCH] Add a `defaults` keyword to `milla.util.read_config` --- src/milla/util.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/milla/util.py b/src/milla/util.py index 379ab4c..db0c4a6 100644 --- a/src/milla/util.py +++ b/src/milla/util.py @@ -68,7 +68,7 @@ def http_date(date): return format_date_time(stamp) -def read_config(filename): +def read_config(filename, defaults=None): '''Parse an ini file into a nested dictionary :param string filename: Path to the ini file to read @@ -108,10 +108,10 @@ def read_config(filename): with open(filename) as f: # ConfigParser API changed in Python 3.2 if hasattr(configparser.ConfigParser, 'read_file'): - cparser = configparser.ConfigParser() + cparser = configparser.ConfigParser(defaults) cparser.read_file(f) else: - cparser = configparser.SafeConfigParser() + cparser = configparser.SafeConfigParser(defaults) cparser.readfp(f) config = {}