diff --git a/README.md b/README.md index 9762da6..10a8774 100644 --- a/README.md +++ b/README.md @@ -108,9 +108,14 @@ the default confab console script: so that given an environment named "foo" and a role named "bar", configuration data would be merged between **default.py**, **foo.py**, and **bar.py**. - Confab uses the convention that each module's *__all__* value defines its data, e.g.: - - __all__ = {'foo': 'bar'} + Confab uses the *__dict__*, but filters out any entries starting with '_' e.g.: + + foo = 'bar' + _ignore = this' + + Results in: + + {'foo': 'bar'} - Generated and remote configuration files will always be saved to a directory named after the fully qualified domain name (FQDN) of the target host. diff --git a/confab/data.py b/confab/data.py index e6dae4d..e815ed7 100644 --- a/confab/data.py +++ b/confab/data.py @@ -36,13 +36,12 @@ def import_configuration(module_name, data_dir): """ Load configuration from file as python module. - Treats module's __all__ value as the configuration dictionary. + Returns publicly names values in module's __dict__. """ - # use __all__ as the module's dictionary def as_dict(module): try: - return module.__all__ + return {k: v for k, v in module.__dict__.iteritems() if not k[0:1] == '_'} except AttributeError: return None