mozilla/configman — pull request #68 by twobraids (2013-02-15 20:37:20+00:00)
Title: enhance DotDict indexing mechanisms to make future easier

I'm going to gut and restuff configman to simplify the overlay/expand mechanism. Because it as a big change, I'm going to break it down into bite sized chunks to spread out the reviewing pain.

This is the first chunk - an enhancement to DotDict to allow for more flexible indexing using dotted strings to access nested mappings:

d = DotDict()
d.x = DotDict()
d.x.y = DotDict()
d.x.y.a = 'Wilma'
assert d['x.y.a'] == 'Wilma'
assert d['x.y'].a == 'Wilma'
assert d['x'].y.a == 'Wilma'
assert d.x.y.a == 'Wilma'
assert d.x.y['a'] == 'Wilma'
assert d.x['y.a'] == 'Wilma'
assert d['x'].y['a'] == 'Wilma'
assert d['x']['y']['a'] == 'Wilma'

This will be extraordinarily useful in changes to come.