Mercurial > piecrust2
diff piecrust/configuration.py @ 204:f98451237371
internal: Add ability to get a default value if a config value doesn't exist.
tests: Add some configuration tests.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 18 Jan 2015 11:53:18 -0800 |
parents | b540d431f2da |
children | 45aba3cb7228 |
line wrap: on
line diff
--- a/piecrust/configuration.py Thu Jan 15 22:54:59 2015 -0800 +++ b/piecrust/configuration.py Sun Jan 18 11:53:18 2015 -0800 @@ -39,7 +39,7 @@ def getAll(self): return self.get() - def get(self, key_path=None): + def get(self, key_path=None, default_value=None): self._ensureLoaded() if key_path is None: return self._values @@ -48,7 +48,7 @@ for b in bits: cur = cur.get(b) if cur is None: - return None + return default_value return cur def set(self, key_path, value):