diff options
author | Dan Firth <dan.firth@codethink.co.uk> | 2016-02-23 13:12:53 +0000 |
---|---|---|
committer | Paul Sherwood <paul.sherwood@codethink.co.uk> | 2016-02-27 07:28:56 +0000 |
commit | 6f0533fa428a27016773c11409c113c5defc4ae2 (patch) | |
tree | d3336c72b098eddac280c927bfbc9392d44810cd | |
parent | 70555547bb4cf323a8115fbf0716b862d3af0e61 (diff) | |
download | ybd-wip-overlaps.tar.gz |
Use setdefaultwip-overlaps
-rw-r--r-- | ybd/app.py | 4 | ||||
-rw-r--r-- | ybd/definitions.py | 13 |
2 files changed, 7 insertions, 10 deletions
@@ -140,8 +140,8 @@ def setup(args): config['defdir'] = os.getcwd() config['extsdir'] = os.path.join(config['defdir'], 'extensions') base_dir = os.environ.get('XDG_CACHE_HOME') or os.path.expanduser('~') - if config.get('base', None) is None: - config['base'] = os.path.join(base_dir, config['directories']['base']) + config.setdefault('base', + os.path.join(base_dir, config['directories']['base'])) for directory, path in config.get('directories', {}).items(): try: if config.get(directory) is None: diff --git a/ybd/definitions.py b/ybd/definitions.py index 38ba995..3a5ee12 100644 --- a/ybd/definitions.py +++ b/ybd/definitions.py @@ -163,14 +163,11 @@ class Definitions(object): the same as 'path' but replacing '/' by '-' ''' - if definition.get('path', None) is None: - definition['path'] = definition.pop('morph', - definition.get('name', name)) - if definition['path'] == 'ERROR': - app.exit(definition, 'ERROR: no path, no name?') - if definition.get('name') is None: - definition['name'] = definition['path'] - definition['name'] = definition['name'].replace('/', '-') + definition.setdefault('path', + definition.pop('morph', definition.get('name', name))) + if definition['path'] == 'ERROR': + app.exit(definition, 'ERROR: no path, no name?') + definition.setdefault('name', definition['path']).replace('/', '-') if definition['name'] == app.config['target']: app.config['target'] = definition['path'] |