From e06cf9a97802d4c6a2ab97d973a373675e68b751 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Tue, 16 Aug 2016 14:12:17 -0400 Subject: [PATCH] Add None check to fill_template... ... as requested by @nsoranzo. --- lib/galaxy/util/template.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/galaxy/util/template.py b/lib/galaxy/util/template.py index 8e50f8e34d9..ef62853a781 100644 --- a/lib/galaxy/util/template.py +++ b/lib/galaxy/util/template.py @@ -1,7 +1,16 @@ +"""Entry point for the usage of Cheetah templating within Galaxy.""" from Cheetah.Template import Template def fill_template( template_text, context=None, **kwargs ): + """Fill a cheetah template out for specified context. + + If template_text is None, an exception will be thrown, if context + is None (the default) - keyword arguments to this function will be used + as the context. + """ + if template_text is None: + raise TypeError("Template text specified as None to fill_template.") if not context: context = kwargs return str( Template( source=template_text, searchList=[context] ) )