Mercurial > piecrust2
diff piecrust/configuration.py @ 683:ec384174b8b2
internal: More work/fixes on how default/theme/user configs are merged.
Change how the code is organized to have better data flow. Add some tests.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Wed, 09 Mar 2016 00:23:51 -0800 |
parents | 81d9c3a3a0b5 |
children | 7705b3d981ca |
line wrap: on
line diff
--- a/piecrust/configuration.py Tue Mar 08 01:07:56 2016 -0800 +++ b/piecrust/configuration.py Wed Mar 09 00:23:51 2016 -0800 @@ -124,6 +124,13 @@ return cur +def try_get_dict_value(d, key, default=None): + try: + return get_dict_value(d, key) + except KeyError: + return default + + def set_dict_value(d, key, value): bits = key.split('/') bitslen = len(bits)