config: Add suport for 'key in config' syntax

We can use this instead of the cumbersome `config[key].exists()`.
This commit is contained in:
Thomas Scholtes 2014-09-11 16:09:26 +02:00
parent 7958469b25
commit 5279016db4

View file

@ -220,6 +220,9 @@ class ConfigView(object):
"""
self.set({key: value})
def __contains__(self, key):
return self[key].exists()
def set_args(self, namespace):
"""Overlay parsed command-line arguments, generated by a library
like argparse or optparse, onto this view's value.