summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--morphlib/morphloader.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/morphlib/morphloader.py b/morphlib/morphloader.py
index ff433d73..d7f0fe7e 100644
--- a/morphlib/morphloader.py
+++ b/morphlib/morphloader.py
@@ -585,12 +585,25 @@ class MorphologyLoader(object):
cls._validate_products(morphology['name'],
morphology['products'], errors)
+ for key in MorphologyDumper.keyorder:
+ if key.endswith('-commands') and key in morphology:
+ cls._validate_commands(morphology['name'], key,
+ morphology[key], errors)
+
if len(errors) == 1:
raise errors[0]
elif errors:
raise MultipleValidationErrors(morphology['name'], errors)
@classmethod
+ def _validate_commands(cls, morphology_name, key, commands, errors):
+ for cmd_index, cmd in enumerate(commands):
+ if not isinstance(cmd, basestring):
+ e = InvalidTypeError('%s[%d]' % (key, cmd_index),
+ str, type(cmd), morphology_name)
+ errors.append(e)
+
+ @classmethod
def _validate_products(cls, morphology_name, products, errors):
'''Validate the products field is of the correct type.'''
if (not isinstance(products, collections.Iterable)