From dca866c98d22b6c702cf2c952a994df203f5dbb5 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Mon, 26 Mar 2018 12:35:13 +1100 Subject: [PATCH] Tools: make parameter generation failure clearer --- Tools/autotest/param_metadata/htmlemit.py | 2 ++ Tools/autotest/param_metadata/mdemit.py | 2 ++ Tools/autotest/param_metadata/wikiemit.py | 2 ++ Tools/autotest/param_metadata/xmlemit.py | 2 ++ 4 files changed, 8 insertions(+) diff --git a/Tools/autotest/param_metadata/htmlemit.py b/Tools/autotest/param_metadata/htmlemit.py index 493a0b6b5a..f492d442e8 100644 --- a/Tools/autotest/param_metadata/htmlemit.py +++ b/Tools/autotest/param_metadata/htmlemit.py @@ -69,6 +69,8 @@ DO NOT EDIT t += "\n" for value in values: v = value.split(':') + if len(v) != 2: + raise ValueError("Bad value (%s)" % v) t += "\n" % (v[0], v[1]) t += "
ValueMeaning
%s%s
\n" elif field == 'Units': diff --git a/Tools/autotest/param_metadata/mdemit.py b/Tools/autotest/param_metadata/mdemit.py index 806765fd28..d40ee4519a 100644 --- a/Tools/autotest/param_metadata/mdemit.py +++ b/Tools/autotest/param_metadata/mdemit.py @@ -98,6 +98,8 @@ class MDEmit(Emit): t += "\n|:---:|:---:|" for value in values: v = value.split(':') + if len(v) != 2: + raise ValueError("Bad value (%s)" % v) t += "\n|%s|%s|" % (v[0], v[1]) else: t += "\n\n- %s: %s" % (field, param.__dict__[field]) diff --git a/Tools/autotest/param_metadata/wikiemit.py b/Tools/autotest/param_metadata/wikiemit.py index e921adb5e6..4134b70c04 100644 --- a/Tools/autotest/param_metadata/wikiemit.py +++ b/Tools/autotest/param_metadata/wikiemit.py @@ -62,6 +62,8 @@ class WikiEmit(Emit): t += "|| *Value* || *Meaning* ||\n" for value in values: v = value.split(':') + if len(v) != 2: + raise ValueError("Bad value (%s)" % v) t += "|| " + v[0] + " || " + self.camelcase_escape(v[1]) + " ||\n" elif field == 'Units': abreviated_units = param.__dict__[field] diff --git a/Tools/autotest/param_metadata/xmlemit.py b/Tools/autotest/param_metadata/xmlemit.py index 8e8d0b642a..0ca747b34e 100644 --- a/Tools/autotest/param_metadata/xmlemit.py +++ b/Tools/autotest/param_metadata/xmlemit.py @@ -57,6 +57,8 @@ class XmlEmit(Emit): values = (param.__dict__[field]).split(',') for value in values: v = value.split(':') + if len(v) != 2: + raise ValueError("Bad value (%s)" % v) t += '''%s\n''' % (quoteattr(v[0]), escape(v[1])) # i.e. numeric value, string label t += "\n"