diff genshi/template/plugin.py @ 545:6e21c89d9255

Support for Python code blocks in templates can now be disabled. Closes #123.
author cmlenz
date Thu, 28 Jun 2007 23:00:24 +0000
parents 19c7dc1e4dd5
children 7145e4eba2ec f0bb2c5ea0ff
line wrap: on
line diff
--- a/genshi/template/plugin.py
+++ b/genshi/template/plugin.py
@@ -67,11 +67,18 @@
             raise ConfigurationError('Unknown lookup errors mode "%s"' %
                                      lookup_errors)
 
+        try:
+            allow_exec = bool(options.get('genshi.allow_exec', True))
+        except ValueError:
+            raise ConfigurationError('Invalid value for allow_exec "%s"' %
+                                     options.get('genshi.allow_exec'))
+
         self.loader = TemplateLoader(filter(None, search_path),
                                      auto_reload=auto_reload,
                                      max_cache_size=max_cache_size,
                                      default_class=self.template_class,
                                      variable_lookup=lookup_errors,
+                                     allow_exec=allow_exec,
                                      callback=loader_callback)
 
     def load_template(self, templatename, template_string=None):
Copyright (C) 2012-2017 Edgewall Software