diff options
author | Adam Coldrick <adam.coldrick@codethink.co.uk> | 2014-08-08 08:32:46 +0000 |
---|---|---|
committer | Adam Coldrick <adam.coldrick@codethink.co.uk> | 2014-08-14 13:28:50 +0000 |
commit | e15c4fd713ee4222ebd0a0c1740e6fb91e15cbad (patch) | |
tree | bd68793482703ee061e4ef069f2ffbba6a84104a | |
parent | 9afaefb4c84ca1623d8eb9766f0d6031d2ed2f83 (diff) | |
download | morph-e15c4fd713ee4222ebd0a0c1740e6fb91e15cbad.tar.gz |
morphset: Don't expect to be able to find `morph` or `name`
Currently, morphloader sets the morph field in chunk specs by default.
A later commit will remove this behaviour, so morphset needs to stop
expecting the `morph` field to exist in morphology specs. However,
stratum specs don't have a `name` field so we can't expect to be able to
find that either.
-rw-r--r-- | morphlib/morphset.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/morphlib/morphset.py b/morphlib/morphset.py index fa525973..bf061f94 100644 --- a/morphlib/morphset.py +++ b/morphlib/morphset.py @@ -127,7 +127,8 @@ class MorphologySet(object): specs = m[kind] for spec in specs: if cb_filter(m, kind, spec): - fn = morphlib.util.sanitise_morphology_path(spec['morph']) + fn = morphlib.util.sanitise_morphology_path( + spec['morph'] if 'morph' in spec else spec['name']) orig_spec = (spec.get('repo'), spec.get('ref'), fn) dirtied = cb_process(m, kind, spec) if dirtied: @@ -148,7 +149,8 @@ class MorphologySet(object): if m.ref != spec.get('ref'): m.ref = spec.get('ref') m.dirty = True - file = morphlib.util.sanitise_morphology_path(spec['morph']) + file = morphlib.util.sanitise_morphology_path( + spec['morph'] if 'morph' in spec else spec['name']) assert (m.filename == file or m.repo_url == spec.get('repo')), \ 'Moving morphologies is not supported.' @@ -162,7 +164,7 @@ class MorphologySet(object): ''' def wanted_spec(m, kind, spec): - spec_name = spec.get('name', spec['morph']) + spec_name = spec['name'] if 'name' in spec else spec['morph'] return (spec.get('repo') == repo_url and spec.get('ref') == orig_ref and spec_name == morph_name) |