[bitbake-devel] [PATCH 03/23] toastergui: enable strict variable checking
Alex DAMIAN
alexandru.damian at intel.com
Thu Jun 25 10:33:40 UTC 2015
From: Alexandru DAMIAN <alexandru.damian at intel.com>
In order to make sure we don't use undefined variables in the
templates, we enforce strict variable checking in the templating
engine.
Signed-off-by: Alexandru DAMIAN <alexandru.damian at intel.com>
---
lib/toaster/toastermain/settings.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/lib/toaster/toastermain/settings.py b/lib/toaster/toastermain/settings.py
index 3c7cb3b..141ad08 100644
--- a/lib/toaster/toastermain/settings.py
+++ b/lib/toaster/toastermain/settings.py
@@ -386,3 +386,10 @@ connection_created.connect(activate_synchronous_off)
#
+class InvalidString(str):
+ def __mod__(self, other):
+ from django.template.base import TemplateSyntaxError
+ raise TemplateSyntaxError(
+ "Undefined variable or unknown value for: \"%s\"" % other)
+
+TEMPLATE_STRING_IF_INVALID = InvalidString("%s")
--
1.9.1
More information about the bitbake-devel
mailing list