New issue 26 by alikins: ConfigParse compat mode with a defaults
{'foo'=None} returns string 'None'
http://code.google.com/p/iniparse/issues/detail?id=26
What steps will reproduce the problem?
With a 'test.ini' like:
[test]
foo = blip
and code like:
from iniparse import SafeConfigParser
defaults = {'foo':'bar', 'blip': None}
cp = SafeConfigParser(defaults = defaults)
cp.read('test.ini')
a = cp.get('test', 'blip')
print a, type(a)
What is the expected output? What do you see instead?
ConfigParser.SafeConfigParser will return None in this case
What version of the product are you using? On what operating system?
python-iniparse-0.4-2.fc14.noarch, python 2.7
Please provide any additional information below.
I can reproduce it. (python 2.7)
ConfigParser.SafeConfigParser will return None
and iniparse will return 'None'
But it is a little tricky because you can't write a None type to an ini
file and get it back as a None type. So the your can get a None value in a
default dict, but not from reading from a real ini file. So you can discuss
if it a bug in ConfigParser to able to set a default value, that is a
differnt type that the one you can read from an ini file (string, int &
boolean)
Put anyway if iniparse should be compatible with Configparser, then it
should act in the same way :)