diff options
Diffstat (limited to 'morphlib/morph2.py')
-rw-r--r-- | morphlib/morph2.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/morphlib/morph2.py b/morphlib/morph2.py index 0e0d9201..942322ee 100644 --- a/morphlib/morph2.py +++ b/morphlib/morph2.py @@ -1,4 +1,4 @@ -# Copyright (C) 2012-2013 Codethink Limited +# Copyright (C) 2012-2014 Codethink Limited # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -87,6 +87,14 @@ class Morphology(object): def __contains__(self, key): return key in self._dict + # Not covered by tests, since it's trivial, morph2 is going away + # and only exists so the new morphology validation code can use it. + def get(self, key, default=None): # pragma: no cover + try: + return self[key] + except KeyError: + return default + def get_commands(self, which): '''Return the commands to run from a morphology or the build system''' if self[which] is None: |